jquery停止后重新启动动画
可能重复:
Jquery连续循环动画
当div计时器达到940px时,我希望这个动画重新启动。 到目前为止我有这个:
$('.timer').animate({'width':940}, {queue:false, duration:5000, easing: 'linear'}); if ($('.timer').width() == 940){ $('.timer').width() == 0; $('.timer').animate({'width':940}, {queue:false, duration:5000, easing: 'linear'}); }
重新启动动画循环:
$(".timer").bind("animation.loop", function(){ $(this).animate({width: 940}, 5000, function(){ $(this).animate({width: 0}, 5000, function(){ $(this).trigger("animation.loop"); }); }); }).trigger("animation.loop");
做动画,硬重置,再次动画:
$(".timer").bind("animation.loop", function(){ $(this).animate({width: 940, easing: 'linear'}, 5000, function(){ $(this).css("width", 0).trigger("animation.loop"); }); }).trigger("animation.loop");