How To Use jQuery with MooTools

Wed, May 20, 2009

Tutorials & Tips


jQuery and MooTools are 2 great javascript frameworks that allow you to incorporate some really fancy effects on your website. I was using them while I realised that I had to use both of them on a single page at one point. I didn’t realise it then, and took me nearly an hour before I realised that the two frameworks were causing some conflicts. For me, I was trying out the accordion effect, and that caused a few compatibility issues — i.e. the javascript effects did not work at all.

<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">
jQuery.noConflict();

(function($) {
/*whatever jQuery stuff*/
})(jQuery);
</script>

<script type="text/javascript" src="moo1.2.js"></script>
<script type="text/javascript">
window.addEvent('domready',function() {
/*whatever MooTools stuff*/
});
</script>

Done! :) By doing this and segregating your javascript effects, you can use both jQuery and MooTools together in a same page.

Similar Posts:

Tags: , , , , , , , , , ,
, , , , , , , , , ,

This post was written by:

- Alvin is a Singaporean who's interested in marketing, techy stuff and likes to just figure out how the two can work with each other. On top of his blog, you can also follow him on Twitter.

Get Alvin's Report On How To Blog Successfully - Free!

2 Comments For This Post

  1. Shell Says:

    I am trying to create a photo gallery using Mootools/Slimbox effect and Jquery Accordion effect I get everything to work but the slimbox effect. If I was to use the code above to see if that helps where do I put it, into the webpage itself or one of the files that come with jquery or mootools…

  2. Alvin Says:

    into the webpage itself :)

Leave a Reply

*