Javascript libraries working together
August 21st, 2009
Mootools and Jquery
I Started freshfreelance site a while ago and used the mootools Kwix script for the sites main menu.
Took me a while to sort it, and was to be honest never as good as the example, but hey..
All was fine, until I used lightbox on one of the sub pages, they worked fine independently, but when together the lightbox wouldn’t work.
I googled for a while, but found no solution I could get my head round at the time, so I took the cop out and disabled the javascript on the menu, (Just for that one page) allowing the lightbox script to work.
Time passed
and I learned to live with it.
Today however I came across the problem again, wanting to implement the JQuery cycle script to cycle some pics, wouldn’t work, and I knew instantly it was the libraries cinfkict.
Googling more successful this time.
Enter:
jQuery’s no-conflict mode,
I have rambled enough:
the solution as I see it.
This is what I had and it worked solo,
<script type="text/javascript"> $(document).ready(function() { $('#slideshow11').cycle(); }); </script>
I added
var J = jQuery.noConflict();
and changed the $ for J in the function, and Presto.
<script type="text/javascript"> var J = jQuery.noConflict(); J(document).ready(function() { J('#slideshow11').cycle(); }); </script>
There are more elegant solutions out there, Check: JQuery, and I found help here. Michael Shadle
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed