Jump to:

10844 Posts in 2515 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » Resolve jQuery Conflict?!

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 786 Views
  • arthurdent
    Avatar
    Community Member
    132 Posts

    Resolve jQuery Conflict?! Link to this post

    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?

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Resolve jQuery Conflict?! Link to this post

    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.

  • arthurdent
    Avatar
    Community Member
    132 Posts

    Re: Resolve jQuery Conflict?! Link to this post

    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...

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Resolve jQuery Conflict?! Link to this post

    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?

  • arthurdent
    Avatar
    Community Member
    132 Posts

    Re: Resolve jQuery Conflict?! Link to this post

    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!

    786 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.