Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Resolve jQuery Conflict?!


Go to End


5 Posts   2501 Views

Avatar
mhdesign

Community Member, 216 Posts

16 October 2013 at 10:52am

Edited: 16/10/2013 10:55am

I'm just at the point of completing my first Responsive design theme for Silverstripe.

In order to enable a Lightbox function for the client's products I have to call upon a version of jquery.min.js. And in order to have a functional, fold-away two-level navigation bar that works on smartphone screens I need a different version of jquery.min.js.

  • • The version of jquery for the navbar function is 1.9.1

    • The version used for the lightbox (included in SilverStripe Third Party directory) is 1.7.2

I understand that it is possible to use jquery.noConflict to eliminate conflicts between different version of jQuery. Unfortunately when I use a script to implement this at the base of Page.ss all functionality stops on both jQuery calls.

These scripts are obviously mutually exclusive. Has anybody else struck these issues? How did you fix it?

Avatar
Bambii7

Community Member, 254 Posts

16 October 2013 at 3:46pm

Hi Arthurdent,

Can you only include the 1.9.1 version? Rip out the use of 1.7.2

You don't want to include two versions of jquery. No conflict is only to relinquish the use of $ sign which other frameworks may try to claim for there own use. As you've discovered they won't play nice together.

Avatar
mhdesign

Community Member, 216 Posts

16 October 2013 at 4:36pm

Thanks for your comment Bambii7 -- I did try this. I also tried updating the version of jquery.min.js that is included with SilverStripe. Unfortunately when I did this I lost the PrettyPicture lightbox function, which seems to want to run only on jQuery.min.js v 1.7.2...

Avatar
Bambii7

Community Member, 254 Posts

17 October 2013 at 1:56pm

Hmmm, do you have a link to a staging site where I can inspect?

There were some big changes in Jquery 1.9, I bet theres one function which is now deprecated.

What lightbox are you using? can you find one that uses 1.9 also?

Avatar
mhdesign

Community Member, 216 Posts

18 October 2013 at 8:48am

Actually I went the other way. As I couldn't see a way to resolve the conflict I found a Responsive Navbar script at http://webdesign.tutsplus.com/tutorials/site-elements/big-menus-small-screens-responsive-multi-level-navigation/ that used jQuery 1.7.2 and used that instead. Much simpler!

Thanks for your comments!