Search code examples
jqueryjquery-animatedetach

jquery detach animate() function (not detach or die an event listener)


Hi I'm using a jQuery plugin called pulse (http://james.padolsey.com/javascript/simple-pulse-plugin-for-jquery/), which is working as advertised. It's essentially a short wrapper on animate to have a pulsing effect.

However, what I need to do is to let one div pulse forever until some event, then the code needs to stop this pulse and another div will start pulsing forever. Then they would alternate pulsing.

In short, I need to detach the animate function from a particular div before the function finishes with animate.

I looked into detach() and die() but they only detach specific event listeners. (even with namespace usage, it seems to be the case). I also looked into jQuery.fx.off, but it pauses all animations and when turned back on, all animations resume.

Please let me know if there is any solution to this. Thanks!


Solution

  • Try .stop().