mootools和jquery冲突-noconflict对我不起作用
mootools and jquery conflict - noconflict not working for me
我正在向使用mootools的现有网站添加菜单,我的菜单需要jquery库才能运行。我只能控制添加jquery-js文件和脚本,而mootools必须留在顶部,而我的必须位于其下方。我尝试在文档就绪函数之前添加jQuery.noConflict();
,但无法解决。如果我删除了mootools-js文件,菜单就可以完美地运行了。
<script type="text/javascript" src="http://www16.myfantasyleague.com/mootools-core-1.3.1-full-compat-yc.js"></script>
<script type="text/javascript" src="/js/jquery_1.8.2.js"></script>
<script id="footerScriptsReady" type="text/javascript">
jQuery.noConflict();
(function($){
$('#headerTvRotator').innerfade({ animationtype: 'fade', speed: 250, timeout: 10000, type: 'sequence', containerheight: '40px' });
var saag = CBSi.app.SAAG.init({
'categories':
{
"tab1":{
"scoreboard_url":"#url-here",
"ord":0,
"menu_subtitle":"<a2>For<BR CLEAR=LEFT>Commish</a>",
"default":0,
"content_url":"div_forcommissioners",
"menu_title":"",
"league_abbr":"tabname",
"scoreboard_subtitle":"Live<BR CLEAR=LEFT>Scores"
},
"tab2":{
"scoreboard_url":"#url-here",
"ord":2,
"menu_subtitle":"<a2>For<BR CLEAR=LEFT>Owners</a>",
"default":0,
"content_url":"div_forowners",
"menu_title":"",
"league_abbr":"tabname",
"scoreboard_subtitle":"Live<BR CLEAR=LEFT>Scores"
},
"tab3":{
"scoreboard_url":"#url-here",
"ord":3,
"menu_subtitle":"<a1>REPORTS</a>",
"default":0,
"content_url":"div_reports",
"menu_title":"",
"league_abbr":"tabname",
"scoreboard_subtitle":"Live<BR CLEAR=LEFT>Scores"
}
},
'activeCategory':'tab2'
});
})(jQUery);
</script>
<div id="menuContentsArea" style="display:none;">
<div id="div_myleagues">
<ul id="myleagues">
<!--<li class="myleagues"></li>-->
</ul>
</div>
<div id="div_forowners">
<ul id="forowners">
<!--<li class="forowners"></li>-->
</ul>
</div>
<div id="div_communications">
<ul id="communications">
<!--<li class="communications"></li>-->
</ul>
</div>
</div>
您不能使用$.noConflict
。整个冲突来自使用$
作为别名的两个库。
尝试
jQuery.noConflict();
(function($){
/* within this wrapper "$" is jQuery again*/
$('#headerTvRotator').innerfade.....
})(jQUery);
不要在包装器之外使用任何带有"$"的jQuery代码。。。否则必须使用完整的jQuery单词,如:
jQuery('#headerTvRotator').innerfade.....
相关文章:
- electronic BrowserWindow的最小高度和宽度在hide()show()方法之后不起作用
- 监视函数从服务返回不起作用,但作用域函数起作用
- 幻灯片滚动javascript不起作用
- 简单的javascript在Shopify中不起作用
- Recaptcha在IE7和IE8中不起作用
- Ember Data DS.Model's set函数不起作用
- JsFiddle上的鼠标事件不起作用
- 我的AngularJS表达式没有'不起作用
- 点击按钮输入不起作用
- 面向对象的Javascript代码在IE7中不起作用
- 分部隐藏在jquery中不起作用
- 在phonegap应用程序内部重定向不起作用
- Array.length似乎不起作用;console.log则显示其他情况
- $ionicplatform内的$scope不;不起作用
- 我的javascript for循环不起作用
- Meteor-添加用户自定义字段的方法不起作用
- 为什么 .focus() 不起作用,而 .css(“color”,“red”) 在同一个选择器上起作用
- Textarea必需的attribut在javascript中不起作用
- 为什么javascript:void(0)在Firefox中不起作用
- 退出全屏不起作用