0

I am working on the following site: https://www.jls-concept.fr/
The template is loading jQuery twice:
- once from Joomla: https://www.jls-concept.fr/media/jui/js/jquery.min.js
- and another time here: https://www.jls-concept.fr/templates/superfine/assets/js/assets.min.js

where the template author wisely decided to put the minification of several javascript libraries there.

I have tried removing the extra jQuery in assets file, but the site stops working.

I tried changing the content of both js files, trying to make both load the same version but to no avail.

I don't have much expertise with joomla nor frontend.

Any help is much appreciated.

  • jQuery easy plugin? Works a wonder in this situation – Lodder May 13 '17 at 22:06
2

I suspect the issue may be that Joomla's jQuery is set no noconflict mode. Adding the second instance of jQuery is then probably allowing scripts to us $ as a jQuery reference.

Try removing the template's jQuery code and adding the following in its place:

$ = jQuery.noConflict(true);

This should mean subsequent scripts can once again use the dollar to represent jQuery.

If that doesn't work, try looking at your console (F12) to see what javascript errors are being thrown. Adding this to your question may help locate the source of the problem.

  • It seems like the assets file can't read the jquery included by joomla. I have removed the jQuery included by the template and I added what you suggested. This is what I got. Uncaught TypeError: Cannot read property 'noConflict' of undefined at assets.min.js:7 – Mhd.Tahawi May 7 '17 at 15:42
0

At the end of index.php in your template you can add this. It will remove Joomla! instance of jQuery.

$document = JFactory::getDocument();
unset($document->_scripts['media/jui/js/jquery.min.js']);

Just make sure that you still gonna have jQuery loaded before any other scripts that require jQuery (in this case the assets.min.js).

You can also try to search for uncompressed version of assets.min.js and then remove the jQuery. Or decompress it using tool like this and then remove it.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.