Are you enjoying the extensions? Did you like the support? Help others decide.

Leave a review
29Oct2015
Information
Print

Making the cut with jQuery and MooTools in Joomla: The multiple jQuery libraries loading problem - Part 2

Information
First published September 15, 2011
12257 hits -
 

There is an alternative to code jQuery library calls into a Joomla! template or into the Joomla! core. Nowadays, there is a pletora of jQuery plugins available in the Joomla! Extensions Directory that can help ease the process.

Although usefull, they don't always provide the results desired (jQuery calls before MooTools calls, partial clearing of other jQuery library calls, ...). They come with tons of features or only deal with the front or back end.

More and more components, modules and plugins also need in-house extra extensions in order to work (adding jQuery to the back-end among other things). It makes a lot of sense when it comes to code re-use. These extensions add extra functionnality and improve the user experience.

When it comes to putting a website together, many of those extensions can be used. They don't always handle the compatibility with other libraries very well (turning on and off parameters at the administrative level is not always done right) and the outputed code can become a nightmare of endless library calls, increasing loading times and is prone to errors.

In order to make the process a little easier, we created the jQuery Easy plugin. The major advantage in using this plugin is its way to handle other jQuery library calls (coming from other extensions). It cleans the code, adding the necessary libraries after the MooTools calls.



Note: in some cases the Mootools files are loaded after jQuery. It turns out that you are fine even if jQuery loads before MooTools as long as the jQuery.noConflict declaration is loaded immediately after the jQuery library (and before the MooTools library files). In order for that to happen with the jQuery Easy plugin, go to the advanced section of the plugin and set the jQuery no conflict code to 'script' instead of 'script declaration'. It will ensure that the 'no conflict' code is loaded just after the jQuery library and before MooTools (Joomla! loads all scripts before loading all script declarations).