我使用jQuery动画队列来执行角色的跳跃动画。我想判断这个角色在完成所有动画后是否成功。但是函数总是在他完成动画之前执行。是否有侦听器来判断队列中的所有动画是否都已完成?
$('.character').dequeue("myAnimation");
if(self.currentlocation >= this.totalStep){
while($('.character').is(":animated")){
setTimeout(function(){}, 500)
}
alert('win!');
self.success();
}发布于 2016-05-26 08:36:42
如果您讨论的是使用jQuery设置的动画,那么代码就会很简单:
$('.character').promise().done(function(){
// all animations for this matched set are done
});
https://stackoverflow.com/questions/37455517
复制相似问题