Any way I can use two different versions of jquery on one page?

  • # March 12, 2012 at 2:24 pm

    Hey guys, have just run into a problem on a new site, I know that one version of jQuery cancels out another, but I need the two too work, is this possible? if so how? thankyou, Luke

    # March 12, 2012 at 2:28 pm

    Why do you need both to run? Could you not just let the later version of the two do the work?

    # March 12, 2012 at 2:41 pm

    No idea why you’d want that, and I definitely not recommend it (I’m sure there will be conflicts!), but you might want to try this. Say you’re loading two jQuery library files (jquery-1.js and jquery-2.js).

    1. At the end of jquery-1.js, add this line: j1$ = jQuery.noConflict();

    2. At the end of jquery-2.js, add this line: j2$ = jQuery.noConflict();

    3. To do anything with the first library, instead of something like $('#blah').show();, use j1$('#blah').show();

    4. To do anything with the second library, instead of something like $('#blah').show();, use j2$('#blah').show();

    Haven’t tested it myself, but see if it works for you.

    # March 12, 2012 at 3:08 pm

    Sorry should have explained better in my first post, I’m wanting to use jparallax, and it only works well with 1.2.6. Of course im wanting to use the latest version with everything else. Ill be sure to try that out after work. Thanks

    # March 12, 2012 at 3:26 pm

    The version of jParallax on GitHub supports version 1.6.1

    I’m sure it would work with the latest version, it just looks like it hasn’t been updated in a while

    # March 12, 2012 at 3:45 pm

    why thankyou :D never saw that :)

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.