【发布时间】:2011-11-29 11:52:26
【问题描述】:
我正在为我的 Magento 商店使用 2 个 jquery 脚本。其中一个脚本,一个滑块可以完美运行,而另一个则不起作用。
<script type="text/javascript">jQuery.noConflict();jQuery(function($){
function mycarousel_initCallback(carousel)
{
// Disable autoscrolling if the user clicks the prev or next button.
carousel.buttonNext.bind('click', function() {
carousel.startAuto(0);
});
carousel.buttonPrev.bind('click', function() {
carousel.startAuto(0);
});
// Pause autoscrolling if the user moves with the cursor over the clip.
carousel.clip.hover(function() {
carousel.stopAuto();
}, function() {
carousel.startAuto();
});
};
jQuery(document).ready(function() {
jQuery('#mycarousel').jcarousel({
auto: 0,
wrap: 'circular',
animation: 600,
scroll: 6,
initCallback: mycarousel_initCallback
});
$('.block_cart_header').hover(function(){
$('.cart_add_items').fadeIn(700);
},
function(){
$('.cart_add_items').fadeOut(700);
});
});
jQuery(document).ready(function() {
jQuery('.dropdown').selectbox();
}); });</script>
当我删除 jQuery.noconflict();两个脚本都可以工作,但原型脚本不工作。
这是不起作用的脚本:
jQuery(document).ready(function() {
jQuery('.dropdown').selectbox();}); });</script>
【问题讨论】:
-
控制台是否出现任何错误?
-
好问题,这就是我得到的:Uncaught TypeError: Object #
has no method 'attr'
标签: jquery magento prototypejs conflict