PDA

View Full Version : Different Jquery Versions on same site



spookymix
09-28-2010, 04:29 PM
I was wondering how to implement 2 Jquery versions on the same page. I wish to use Versions 1.3.2 and 1.5.1.1. The reason being that certain the plugins I'm using uses to different versions. Please any help would be much appreciated. Thanks

Mike

jscheuer1
09-28-2010, 05:57 PM
The latest nightly build of jQuery is 1.4.3pre. So either you have a typo, or you're mistaken about that 1.5.1.1 version. That actually sounds like a designation for a UI unit or a plug in. In any case, anything that ran under 1.3.2 will run, and more efficiently, under 1.4.2 - the latest official release version.

What you ask can be done, but I question whether or not that's what you really need.

If you want more help:

Please post a link to a page on your site that contains the problematic code so we can check it out.

spookymix
09-28-2010, 07:21 PM
Thanks for the reply.

Here's a link to the site (http://www.calico9.com/site/)

I'm using jQuery 1.3.2 for the preloader (http://www.gayadesign.com/diy/queryloader-preload-your-website-in-style/):

I'm also using light window V2.0 which seems to be conflicting with the preloader. (http://www.p51labs.com/lightwindow/#demos)

It seems like

http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js

is conflicting with:

js/prototype.js

Any help would be much appreciated. Thanks

Mike

jscheuer1
09-28-2010, 08:03 PM
That's jQuery 1.3.2 and 1.4.2 on the page and Prototype 1.5.1.1. You also have Spry on the page.

You only need one jQuery and 1.4.2 is it. You can replace the first call to 1.3.2 with one to 1.4.2 and remove the second call to 1.4.2. But (if you're keeping LightWindow) you must put jQuery into noConflict mode for Prototype and jQuery to both work on the same page. When you do that, some of the code you are using that depends upon jQuery will need changes in order to work.

When I get more time (and if you haven't followed the below advice, which is a better solution), I'll look into how extensive those changes will need to be. If it's not too much, I'll give a specific solution. The presence of Spry might be a deal breaker though. Hopefully not. There are other scripts. You should really consider using ones that only require one library. Right now you have three (Spry, Prototype, and jQuery), four if you include the two versions of jQuery.

Fancybox (http://fancybox.net/) (jQuery based) can do pretty much what LightWindow can, so you could get rid of LightWindow and all of its support files. Just that and switching over to only one version of jQuery (make sure not to add another copy/version of jQuery when installing Fancybox) as indicated above would probably take care of things, assuming Spry is not an issue, which it doesn't look to be. However, it looks like all you need Spry for is a collapsible panel. jQuery can probably do that as well, you just have to find or write the code for that in jQuery.

Just make sure that the one external tag to jQuery is to version 1.4.2 and comes before all other scripts that use jQuery.

spookymix
09-28-2010, 08:45 PM
Thanks for the solution!

I'm going to go the fancybox route and use one version of JQuery...1.4.2. Thanks again you're the best!