The easiest way to do this is using the .is() method and the :animated
selector:

if (!$(this).is(':animated')) {
    (only runs if the element isn't being animated)
}

Also, if you do want to run anyways, but cancel all current
animations, you've got to add a little bit to the above, as .stop()
only cancels the current animation, but will allow any others that are
queued to start, so you have to do:

$(this).queue([]).stop();

See: http://docs.jquery.com/Effects/queue

Passing it an empty array removes all other queued animations.

Reply via email to