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.

All other Modules

Discuss all other Modules here.

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

Resolve jQuery Conflict?!


Reply

5 Posts   1013 Views

Avatar
arthurdent

16 October 2013 at 10:52am (Last edited: 16 October 2013 10:55am), Community Member, 166 Posts

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

16 October 2013 at 3:46pm Community Member, 254 Posts

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
arthurdent

16 October 2013 at 4:36pm Community Member, 166 Posts

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

17 October 2013 at 1:56pm Community Member, 254 Posts

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
arthurdent

18 October 2013 at 8:48am Community Member, 166 Posts

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

Thanks for your comments!