jquery,如何在确保它不是同时动画之后动画元素

时间:2009-12-04 02:03:39

标签: javascript jquery jquery-selectors

$("sth").not(':animated').animate();

这是确定它在同一时刻没有动画的动画元素的最佳方法吗?

谢谢

1 个答案:

答案 0 :(得分:3)

取决于你想要的,是的。虽然我很好奇sth选择器是什么:)

$("#id:not(:animated)").animate(); // Is another way to write it

或者,如果您只想在再次设置动画之前停止播放,请使用stop()

$("#id").stop().animate();