0

Bootstrap.js is breaking a menu plugin I'm using. It's called with this

  $bootstrap = $theme_path . '/js/bootstrap.js';
  $js[$bootstrap] = drupal_js_defaults($bootstrap);
  $js[$bootstrap]['group'] = JS_THEME;
  $js[$bootstrap]['scope'] = 'footer';

in themes/bootstrap/theme/alter.inc. I tried putting a modified alter.inc inside themes/child_theme/theme/ but it doesn't work. Is there a function I can use to override it?

1 Answer 1

1

If you really want to remove bootstrap.js you can do it this way:

function YOURTHEME_js_alter(&$js) {  
  $bootstrap = drupal_get_path('theme', 'bootstrap') . '/js/bootstrap.js';
  unset($js[$bootstrap]);
}

It might fix your menu plugin but it'll remove every drupal specific bootstrap js code (tabs, popovers, tooltips and anchors stuff).

6
  • Is there a way I can remove one part of it? jQueryscrollableElement.once('bootstrap-anchors', function () { jQueryscrollableElement.on('click.bootstrap-anchors', 'a[href*="#"]:not([data-toggle],[data-target])', function(e) { this.scrollTo(e); }); }); is what's breaking my plugin
    – James
    Commented May 9, 2015 at 2:45
  • 1
    Go to admin/appearance/settings/yourtheme, Javascript tab, uncheck smooth scrolling. That should do it.
    – Ben
    Commented May 9, 2015 at 4:09
  • It doesn't unfortunately. I get "this.scrollTo is not a function"
    – James
    Commented May 9, 2015 at 4:49
  • Oh, looking at the actual code, disabling anchor fixing should do it.
    – Ben
    Commented May 9, 2015 at 5:36
  • you deleted your comment on my other post but I think you're onto something... what's the syntax for printing a field? I tried a few different ways but got errors.
    – James
    Commented May 11, 2015 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.