2010-01-06 43 views

回答

3
$(".ImageRoller ul").animate (
    { 
     'marginLeft' : "-"+ScrollWidth+"px" 
    }, 
    { 
     duration: Speed, 
     complete: function() { doSomething(); } 
    } 
); 
4

按照documentation一旦动画结束时,你可以定义一个回调函数将被称为:

动画(参数,可以[时间],[宽松], [回调])

$(".ImageRoller ul").animate(
    {'marginLeft' : "-"+ScrollWidth+"px"}, 
    Speed, 
    'linear', 
    function() { 
     alert('animation end'); 
    } 
); 
+0

感谢您的快速答案,它的效果很好 – ValiL 2010-01-06 08:09:55

+0

我认为K Prime的答案更加正确。 – joetsuihk 2010-01-06 08:25:58

+0

它实际上(或应该是,内部)相同 - jQuery'animate'接受这两种类型的调用 – 2010-01-06 09:25:23