Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop an effect in jQuery

I have a page that uses

$(id).show("highlight", {}, 2000);

to highlight an element when I start a ajax request, that might fail so that I want to use something like

$(id).show("highlight", {color: "#FF0000"}, 2000);

in the error handler. The problem is that if the first highlight haven't finished, the second is placed in a queue and wont run until the first is ready. Hence the question: Can I somehow stop the first effect?

like image 881
Mr Shark Avatar asked Sep 12 '08 20:09

Mr Shark


1 Answers

I listed this as a comment for the accepted answer, but I thought it would be a good idea to post it as a standalone answer as it seems to be helping some people having problems with .stop()


FYI - I was looking for this answer as well (trying to stop a Pulsate Effect), but I did have a .stop() in my code.

After reviewing the docs, I needed .stop(true, true)

like image 164
Dutchie432 Avatar answered Sep 23 '22 08:09

Dutchie432