trrrrrrm
trrrrrrm

Reputation: 11822

jquery, how to animate element after being sure that it's not being animated at the same time

$("sth").not(':animated').animate();

hey

is this the best way to animate element after being sure that it's not being animated at the same moment ?

thanks

Upvotes: 0

Views: 86

Answers (1)

Doug Neiner
Doug Neiner

Reputation: 66231

Depending on what you want, yes. Though I am curious what the sth selector is :)

$("#id:not(:animated)").animate(); // Is another way to write it

Or if you simply want to stop it before it animates again, use stop():

$("#id").stop().animate();

Upvotes: 3

Related Questions