How to fix Mootools and jQuery conflict on Joomla aiContactSafe

北慕城南 提交于 2019-12-25 02:19:13

问题


Overview

I have a Joomal 2.5 website with AiContactSafe contact form installed. Standard AiContactSafe works as a component which means, I cannot include a contact form into an article, it has be on its on taking the whole page on my website.

AiContactSafe has a plugin called AiContactSafeForm which enables users to add a form into a page using a tag like {aicontactsafeform pf=3}. Number 3 is the id of the form. And what this does is, it enables users to add a form into an article. This plugin uses MooTools.

Issue

This works fine as long as I have no jQuery on my page. And when I have jQuery, it clashes with the MooTools library braking my website.

Question

How do I fix the jQuery clash. I tried adding $.noConflict() to the top of the page after jQuery.1.8 script but this doesnt fix it. Has any one come across this same issue? Can someone help me to figure this out? Thanks guys.


回答1:


Try adding the noConflict via this code:

$document = JFactory::getDocument();
$document->addScript( '[path to jquery]' );
$noconflict = 'jQuery.noConflict();';
$document->addScriptDeclaration( $noconflict );


来源:https://stackoverflow.com/questions/13040218/how-to-fix-mootools-and-jquery-conflict-on-joomla-aicontactsafe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!