0

重複の可能性:
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'});
}
4

1 に答える 1

1

アニメーション ループを再開しています:

$(".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");
于 2013-01-25T21:40:54.147 に答える