我正在使用 .animate 在 map 图片周围移动一个红色的 css 圆圈。在第 5 个动画之后,jquery .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 个命令起作用。为什么它在 5 个 .animate 后停止工作?
最佳答案
请参阅 "x"
最后两次调用 .animate()
,作为 value< 传递的无效
设置 .尝试将 unit
值参数"x"
更改为 "px"
.animate({top: "310px", left: "895px"}, 1500)
.animate({top: "310px", left: "865px"}, 1500);
关于javascript - 您可以使用的 .animate() 的数量是否有限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32960665/