harsh
harsh

Reputation: 131

hold animation for some time period in jquery

this is the code i've written inside jquery document.ready function.It moves a div in a circlular path when the page is loaded. div is having class 'pixel' . Now i want to hold the animation for suppose 3secs so that when the page is loaded no action is seen and after 3 secs div should get start moving. here 4000 is the time period of animation occurs.

var i =0;
$(".pixel").each(function(){
    $(this).animate({path: Paths[type][i] }, 4000)
    i++;
})

Upvotes: 0

Views: 679

Answers (1)

voigtan
voigtan

Reputation: 9031

you can use setTimeout:

setTimeout(function() {
    var i =0;
    $(".pixel").each(function(){
        $(this).animate({ path: Paths[type][i++] }, 4000);
    });
}, 3000);

Upvotes: 1

Related Questions