0

This is my site: investassure and I tried incorporating the code for 'button dropdown' from bootstrap. This works only with jquery-1.8+ but the flexslider I used works ONLY with 1.5. As a result, I'm getting this error:

 Uncaught TypeError: Object [object Object] has no method 'on' 

I tried using jquery_update, didn't work. There is only one version added on the page right now, which is 1.5. I didn't find a version of flexslider which works with version 1.7+. What else can I do?

1 Answer 1

1

I recommend the jQuery Multi module.

It allows you to use the default drupal jQuery version for most of you site, and use newer versions of jQuery just for plugins that require it.

It gives an administration page where you can choose which libraries to load using the newer jQuery.

It also has hooks you can use to tell it to load your libraries using different jQuery versions.

If you are writing custom js it also namespaces the jquery versions so you can do something like:

(function ($) {
  // All your code here
})(jq172);

That is how the module would namespace jQuery 1.7.2 and you can load your scripts like that to use the newer versions.

One thing to note is that if your plugins with new jQuery require things like jquery UI, jquery.once etc., that drupal core uses already, you have to make sure they are added a second time, so they are added to the normal drupal jquery and the newer one.

2
  • Also note that the jquery_update module is now a viable alternative. I didn't mention it originally because it used to be very buggy.
    – rooby
    Commented Feb 3, 2014 at 21:30
  • Can you please answer this? drupal.stackexchange.com/questions/236675/…
    – Umair
    Commented May 20, 2017 at 6: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.