2011-09-08 34 views
0

这是我写在jquery document.ready函数中的代码,它在页面加载时移动了一个细胞路径中的div。 div有类'像素'。现在我想为动画假设3secs,这样当页面加载时看不到动作,3秒后div应该开始移动。 这里4000是动画发生的时间段。在jquery中保存了一段时间的动画

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

回答

1

可以使用的setTimeout:

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

谢谢buddy..i实际上已经试过了before.anyways我想通什么wrong.it应该在代码 'this.stop()' – harsh