繁体   English   中英

解决多个jQuery文件之间的冲突

[英]Resolving conflict between multiple jQuery files

我的项目中有多个jquery文件。 我使用jquery1.4.2使用facebox但我也需要原型和scriptacolous脚本。 我用过jQuery.noconflict(); 在我的代码中但它不起作用。 这是网址http://mlep.com/~avalon/wordpress/ideas-and-insights/case-studies/

它应该采用这种安排方式,

  1. 加载其他库和其他非jQuery脚本
  2. 加载jQuery库。
  3. 调用jQuery.noConflict。
  4. 加载jQuery插件
  5. 其他jQuery的东西或代码..

像这样的代码,

<script type="text/javascript" src="http://mlep.com/~avalon/wordpress/wp-content/themes/twentyten/facebox/jquery14.js"></script> 
<script type="text/javascript"> 
    var ang = jQuery.noConflict();
</script>
<script type="text/javascript" src="http://mlep.com/~avalon/wordpress/wp-content/themes/twentyten/facebox/facebox.js"></script> 
<script type="text/javascript"> 
   // other jQuery Codes here...
</script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM