开发者

jQuery: stop animation from element?

开发者 https://www.devze.com 2023-02-12 08:03 出处:网络
when applying animation to an element - eg. div.animate() - how can i unbind that animation from sing开发者_运维问答le elements?

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

精彩评论

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