Legycsapo
Legycsapo

Reputation: 315

Joomla modules conflict

I am working ot his project:

www.eltotaldesign.com/planeteco

I have the modules dj image slider, and another named altra switcher. I tried to install Easy Jquery, and other methods, but nothing helps. It's 100% problem with jquery and mootols conflict, but I cannot resolve it. It's there any scripts to resolve this ?

Thanks!

Upvotes: 1

Views: 4140

Answers (3)

thecodedeveloper.com
thecodedeveloper.com

Reputation: 3240

When you need to use more than one javascript library for extended functionality. Two most popular libraries are mootools and jquery. They conflict because mootools is a prototype and jquery is not. But there is a simple technique to fix this. you can use them both without a conflict.

You just need to take 2 precautions.

  1. Add jquery in no conflict mode. It ensures that more than one jquery library can be used simultaneously.

      jQuery.noConflict();
    
  2. Include all your jquery code as below

    (function($){         
      //jquery code goes here.         
     })(jQuery);
    

See the complete code.

   //no conflict jquery
   jQuery.noConflict(); 
   (function($) {
       //jquery code goes here.
    })(jQuery);

Upvotes: 1

Shaz
Shaz

Reputation: 2647

To solve those compatibility issues you can try:

  • Always load Mootools before Jquery
  • Always load and use Jquery noconflict
  • Make sure you load those libraries just once per page
  • Don't load any of them if you aren't going to use it
  • Be careful with joomla cache and when combining js files
  • Use carefully any extension that gives you some control on js libraries:

http://extensions.joomla.org/extensions/site-management/site-performance

http://www.joomlabamboo.com/joomla-extensions/jb-library-plugin-a-free-joomla-jquery-plugin

Upvotes: 2

Tim Wickstrom
Tim Wickstrom

Reputation: 5701

Do you need mootools on the front end of your joomla install?

If not remove it! It will save your visitor from having to load two libs to view your site:

http://magazine.joomla.org/issues/Issue-Feb-2011/item/349-removing-mootools

If you require both make sure any mootools is using the preferred document.id instead of $ as well as setting jquery in noConflict mode.

Hope this helps! Post back the results.

Upvotes: 1

Related Questions