Reputation: 9289
I'm not sure how to incorporate the two jquery libraries that I need to operate slidedeck and lightbox concurrently. If I remove "jquery.js", slidedeck will work but lightbox won't. If I remove "jquery-1.3.2.min.js", on the other hand, lightbox will work but sliddeck won't.
Trying to run them both at the same time results in slidedeck working / lightbox broken, and generates the following report in Google Chrome:
Can anyone help me figure out how to run both of these jquery plugins at the same time?
Thanks, Nick
Upvotes: 1
Views: 1621
Reputation: 31033
use noConflict
<script src='jquery-1.3.2.js'></script>
<script>
var jq132 = jQuery.noConflict();
</script>
<script src='jquery-1.4.2.js'></script>
<script>
var jq142 = jQuery.noConflict();
</script>
use the appropriate versions with the suitable plugins like (the codes do not depict how the plugins are actually used but added just for clarity)
jq132("element").sliddeck(); // i don't know about sliddeck so don't know how to use
and
jq142("element").lightbox();
as @Sparky672 indicated you have to include jquery
before you include any other xyz.js
Upvotes: 1
Reputation: 98718
If I remove "jquery.js", slidedeck will work but lightbox won't.
When you remove jquery.js
, Lightbox does not work because you're including it BEFORE jQuery-1.3.2.min.js
. In other words, with that particular instance of jQuery removed, you're including Lightbox without jQuery at all.
jQuery has to be included before any/all plugins.
If I remove "jquery-1.3.2.min.js", on the other hand, lightbox will work but sliddeck won't.
That's probably because jquery.js
is out of date.
Just include the latest version of jQuery ONCE, and before you include both plugins.
Upvotes: 2
Reputation: 77966
Replace both those with this:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
JQuery is up to 1.6.4 man, gotta keep up :)
Upvotes: 2