开发者

End the jQuery function when its recalled

i build a jQuery function here http://jsfiddle.net/JuW3B/3/

i want this function stop animating and completes it's animation when it's recalled by another action before the first animation completed,

so, when it's called like this

$('.a').pushUp();

and then another action which call to this开发者_StackOverflow function before the first function completing it's animation

$('.b').pushUp();

i want to forcedly ended the first function before the second function begin


To stop the animation for $('.a') you can simply call $('.a').stop(true, true); The second boolean will determine whether the animation goes straight to the end or not.

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

I don't know what exactly you want to do, but I just tested it on your fiddle and it stops AAA from animating : http://jsfiddle.net/JuW3B/7/

BTW, I changed the pushUp value to 10000 to see it a little slower.

Regards.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜