如何避免joomla中两个模块之间的jquery冲突?

时间:2011-06-27 12:14:42

标签: jquery joomla1.5

我必须在joomla网站中使用mod_lof articleslideshowccnewsletter。现在我正在遭受这些模块的js冲突。我试过noConflict js来避免这种情况,但是没有用。

$ is not a function
 $('gototop').setStyle('opacity','0');
index....sletter (line 109)
$ is not a function
 var css=this.select(property,to);retur...parsed[p]=this.css[p].parse(to[p]);}
mootools.js (line 60)
$ is not a function
 var css=this.select(property,to);retur...parsed[p]=this.css[p].parse(to[p]);}
mootools.js (line 60)
$ is not a function
 var css=this.select(property,to);retur...parsed[p]=this.css[p].parse(to[p]);}
mootools.js (line 60)
$ is not a function
 var css=this.select(property,to);retur...parsed[p]=this.css[p].parse(to[p]);}
mootools.js (line 60)
$ is not a function
var css=this.select(property,to);retur...parsed[p]=this.css[p].parse(to[p]);

请给我一些解决方案。

2 个答案:

答案 0 :(得分:2)

我一直只使用SC jquery插件,它有一个设置,即诞生不启用冲突模式。

http://extensions.joomla.org/extensions/core-enhancements/scripts/7230?qh=YToxOntpOjA7czo4OiJzY2pxdWVyeSI7fQ%3D%3D

答案 1 :(得分:1)

我猜这些是插件。你能检查插件来源吗?它们应该包含以下约定:

(function($){
    //plugin code
})(jQuery)

这可以避免将jQuery对象作为参数$传递给插件时发生的任何冲突。

如果不存在,则存在冲突的危险。

如果在源代码中,使用jQuery代替$应该可以解决问题。

相关问题