开发者

hold animation for some time period in jquery

开发者 https://www.devze.com 2023-04-03 22:41 出处:网络
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 a

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号