this is the code i've w开发者_运维技巧ritten 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++;
})
you can use setTimeout:
setTimeout(function() {
var i =0;
$(".pixel").each(function(){
$(this).animate({ path: Paths[type][i++] }, 4000);
});
}, 3000);
精彩评论