esedic
11/17/2015 - 10:42 PM

Fix Mootools conflicts with Bootstrap Joomla templates when you use an extension that requires Mootools

Fix Mootools conflicts with Bootstrap Joomla templates when you use an extension that requires Mootools

/* 
* Add missing Mootools when Bootstrap is loaded
* This fix creates dummy implementations for the missing Mootools functions.
* It requires that you have jQuery loaded and if you are dealing with Mootools + jQuery is a good idea to add the call just before this javascript code.
* This issue shouldn't affect Bootstrap 3 templates but the fix explained here should be compatible with both.
*/
(function($)
{
    $(document).ready(function(){
        var bootstrapLoaded = (typeof $().carousel == 'function');
        var mootoolsLoaded = (typeof MooTools != 'undefined');
        if (bootstrapLoaded && mootoolsLoaded) {
            Element.implement({
                hide: function () {
                    return this;
                },
                show: function (v) {
                    return this;
                },
                slide: function (v) {
                    return this;
                }
            });
        }
    });
})(jQuery);