nkcmr
nkcmr

Reputation: 11000

Is there a jQuery method that determines whether an element is currently being animated or not in the form of a boolean?

The reason I ask is because I want to disable clicking of a show button WHILE the element it is animating is in the process of being animated.

Upvotes: 3

Views: 89

Answers (2)

karim79
karim79

Reputation: 342635

if($("#someElement").is(":animated")) {
    ...
}

if($("#someElement:animated").length) {
    ...
}

// etc

So you can do:

$("#showBtn").attr("disabled", $("#someElement").is(":animated"));

http://api.jquery.com/animated-selector/

Upvotes: 2

Emmett
Emmett

Reputation: 14327

Use the :animated selector:

var isAnimated = $('#button').is(':animated');

http://api.jquery.com/animated-selector/

Upvotes: 2

Related Questions