Login / Logout



Advertisement

jQuery Module for Joomla

How to use jQuery and Mootools together in Joomla

Does your Joomla site need jQuery and MooTools?
I made a module that loads jQuery as avoiding the confliction when you try using them together.

According to some websites (See an example) how we can use both frameworks is as follows:

  1. Load jQuery
  2. Execute "jQuery.noConflict();"
  3. Load MooTools
  4. Execute javascript as follows:
    • Normal way for Mootools
    • Using "jQuery" instead of "$" for jQuery

It depends on what Joomla extension you use, but my website started displaying javascript errors when I used  both Mootools and jQuery because it just loaded MooTools at first.

So I made a module that avoids the confliction and loads each framework as it should be. I implemented the logic as module instead of plugin because... (skip reading below if you are not a Joomla developer):

  • It did not work when I implemented the logic with onAfterDispatch event. Joomla renders a module after the event and my website uses a module loading the framework(s).
  • It seems troublesome to implement the logic with onAfterRender event. Because I am not a regular expression guru who can easily extract the necessary parts and replace them.

I plan to use this module for all the extensions I am going to have made with jQuery.

Notice

This module may not work properly if the template file is loading jQuery. The template file should not load jQuery if you use this Joomla module anyways.

Update

2011/Oct/29

  • Now you can even avoid loading Mootools with this jQuery module.
  • Now you can use different verison of jQuery. The details for this feature will be found in tooltip for the module parameter  "Source".

 

download

Download Load jQuery Module for Joomla 1.5

Please register or login to download this file

The following is for Joomla 1.6 and 1.7.

download

Download Load jQuery Module for Joomla 1.6, 1.7 and 2.5

Please register or login to download this file

About the Author

Hiro Nozu

Hiro Nozu is a web developer who specializes in building CMS websites with Joomla. He has been in the field for over 10 years, and has been loving every minute of it. Check out some of his past work. He developed the extension Easy Search after the 3 months of involvement in the CMS at iFactory.

Comments (2)

  • Rahul
    Rahul
    30 September 2012 at 21:40 |

    It's a great module. Helped me a lot. I would give this a five star rating if there had any!!!

    Thanks a lot :)

    • Hiro
      Hiro
      01 October 2012 at 09:58 |

      No worries. Happy Joomla day!

Leave a comment

Please login to leave a comment. Optional login below.