2015-10-06 141 views
0

使用.animate在地图的图片周围移动红色css圈。在第五个动画之后,jquery.animate停止工作。我可以使用的金额有限制吗?您可以使用的.animate()的数量是否有限制

function doAnimate() { 
    $("#animate").css({top: "510px", left: "950px"}) 
    .animate({top: "470px", left: "955px"}, 1500) 
    .animate({top: "470px", left: "1050px"}, 1500) 
    .animate({top: "370px", left: "1047px"}, 1500) 
    .animate({top: "370px", left: "865px"}, 1500) 
    .animate({top: "310px", left: "895x"}, 1500) 
    .animate({top: "310px", left: "865x"}, 1500); 
}; 
doAnimate(); 
setInterval(doAnimate, 9100); 

最后一个.animate命令不会工作,但其他5个ontop就可以。为什么5 .animate之后停止工作?

+0

不,没有限制。作为一个方面说明,如果它是相同的值,则不需要再次设置“top”。你的第二个动画CSS可以修改'left'。 –

回答

4

请参阅"x"最后两次调用.animate(),无效unit值参数传递为value进行设置。尝试更改"x""px"

.animate({top: "310px", left: "895px"}, 1500) 
.animate({top: "310px", left: "865px"}, 1500); 
+0

你如何捕捉那样的小错误? o.O – jessica

+0

@jessica _“在第五个动画之后,jquery.animate停止工作。”_ – guest271314

+0

好的。哈哈。 – jessica

相关问题