我在我的网站上使用Colorbox,并且在大多数页面上工作得很好。但在某些页面上,其他jQuery脚本正在使用中,它失败了。
我从IE控制台收到此错误:
SCRIPT438: Object doesn't support property or method 'colorbox'
这是给我带来麻烦的作品
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('.test').colorbox({iframe:true, width:"50%", height:"75%", top:50, scrolling:false, onComplete:true});
});
</script>
头:
<link rel="stylesheet" type="text/css" href="http://www.domain.com/js/calendar/calendar-win2k-1.css" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/teststore/css/styles.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/base/default/css/widgets.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/default/aw_blog/css/style.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/default/onsale/css/product_onsale_label.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/default/onsale/css/category_onsale_label.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/teststore/css/sidenav.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/teststore/css/sidenavcollapse.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/teststore/css/faq/label.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/teststore/css/mageworx/modalbox.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/teststore/css/icart.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/default/css/prolabel.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/teststore/css/colorbox.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.domain.com/skin/frontend/default/teststore/css/print.css" media="print" />
<script type="text/javascript" src="http://www.domain.com/js/jquery/jquery.1.8.2.min.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/jquery/jquery.noconflict.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/prototype/prototype.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/lib/ccard.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/prototype/validation.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/scriptaculous/builder.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/scriptaculous/effects.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/scriptaculous/dragdrop.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/scriptaculous/controls.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/scriptaculous/slider.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/varien/js.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/varien/form.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/varien/menu.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/mage/translate.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/mage/cookies.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/aw_onsale/onsale.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/mageworx/modalbox.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/mageworx/icart.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/varien/product.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/calendar/calendar.js"></script>
<script type="text/javascript" src="http://www.domain.com/js/calendar/calendar-setup.js"></script>
<script type="text/javascript" src="http://www.domain.com/skin/frontend/default/default/js/sidenavcollapse.js"></script>
<script type="text/javascript" src="http://www.domain.com/skin/frontend/default/default/js/faq/faq.js"></script>
<script type="text/javascript" src="http://www.domain.com/skin/frontend/base/default/js/bundle.js"></script>
<link rel="canonical" href="http://www.domain.com/" />
这可能是某种冲突吗?
答案 0 :(得分:0)
在搜索了不同的页面源代码之后,我发现有多个magento扩展正在加载,各种各样的版本都有各种各样的jQuery库。
在评论完所有这些之后,它再次完美无瑕!
请注意自己和其他人,只有1个jQuery lib!
答案 1 :(得分:-1)
更有可能的是,它是如何在其他浏览器中执行的,您是否已尝试剥离最小代码以查看其运行方式?