Skip to content Skip to sidebar Skip to footer

Jquery Restart Animation After It Stops

Possible Duplicate: Jquery Continuously Loop Animation I want this animation to restart when the div timer reaches 940px. So far I have this: $('.timer').animate({'width':940},

Solution 1:

Restarting animated loop:

$(".timer").bind("animation.loop", function(){
    $(this).animate({width: 940}, 5000, function(){
        $(this).animate({width: 0}, 5000, function(){
            $(this).trigger("animation.loop");
        });
    });
}).trigger("animation.loop");

Do the animation, hard reset, animate again:

$(".timer").bind("animation.loop", function(){
    $(this).animate({width: 940, easing: 'linear'}, 5000, function(){
        $(this).css("width", 0).trigger("animation.loop");
    });
}).trigger("animation.loop");

Post a Comment for "Jquery Restart Animation After It Stops"