开发者

jQuery: stop animation from element?

when applying animation to an element - eg. div.animate() - how can i unbind that animation from sing开发者_运维问答le elements?

i've tried div.unbind() and div.unbind("animate") but didnt work..

thanks


I think you need this:

$('#div').stop(); // this stop the currently-running animation

The animation is not bind to an element, it is just an effect => you can't unbind


If you just want to stop the animation on the selected element instead of completely switching animations for all elements, simply use div.stop() or div.clearQueue()

http://api.jquery.com/clearQueue/

http://api.jquery.com/stop/

if you actually use div.stop(true), it will actually call clearQueue as well.


for a single element:

$(selector).clearQueue().stop();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜