4

我无法使以下回调函数工作。永远不会触发警报。然而,初始动画是在“.carousel-images”上执行的。

$('.carousel-images').animate({'left' : left_indent},{queue:false, duration:500},function(){
    alert("animate carousel");

    //get the first list item and put it after the last list item   
    $('.carousel-images li:last').after($('.carousel-images li:first'));  

    //get the left indent to the default  
    $('.carousel-images').css({'left' : '-1200px'});  
});

任何帮助将不胜感激!

4

2 回答 2

1

由于您使用的是第二种方法,因此必须将完整的回调作为属性传递给选项对象

你需要使用

$('.carousel-images').animate({'left' : left_indent},{queue:false, duration:500, complete: function(){
    alert("animate carousel");

    //get the first list item and put it after the last list item   
    $('.carousel-images li:last').after($('.carousel-images li:first'));  

    //get the left indent to the default  
    $('.carousel-images').css({'left' : '-1200px'});  
}});
于 2013-08-01T07:30:33.280 回答
0

你的语法错误,应该是

$('.carousel-images').animate({'left' : left_indent},{queue:false, duration:500, complete: function () {
                ...
            }
        });
于 2013-08-01T07:30:55.123 回答