1
这里是我的动画:JQuery:有没有可能获得动画的结尾?
$(".ImageRoller ul").animate({ 'marginLeft' : "-"+ScrollWidth+"px" },Speed );
现在我希望在动画结束时作出警告或东西。这甚至可能吗?
CHEARS 瓦利
这里是我的动画:JQuery:有没有可能获得动画的结尾?
$(".ImageRoller ul").animate({ 'marginLeft' : "-"+ScrollWidth+"px" },Speed );
现在我希望在动画结束时作出警告或东西。这甚至可能吗?
CHEARS 瓦利
$(".ImageRoller ul").animate (
{
'marginLeft' : "-"+ScrollWidth+"px"
},
{
duration: Speed,
complete: function() { doSomething(); }
}
);
按照documentation一旦动画结束时,你可以定义一个回调函数将被称为:
动画(参数,可以[时间],[宽松], [回调])
$(".ImageRoller ul").animate(
{'marginLeft' : "-"+ScrollWidth+"px"},
Speed,
'linear',
function() {
alert('animation end');
}
);
感谢您的快速答案,它的效果很好 – ValiL 2010-01-06 08:09:55
我认为K Prime的答案更加正确。 – joetsuihk 2010-01-06 08:25:58
它实际上(或应该是,内部)相同 - jQuery'animate'接受这两种类型的调用 – 2010-01-06 09:25:23