Is there a jQuery method that determines if an element is currently animated or not in a logical form?

The reason I'm asking for is because I want to turn off the show WHILE button when the element that it is animating is in the process of animating.

+3
source share
2 answers

Use the selector :animated:

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

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

+2
source
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/

+2
source

Source: https://habr.com/ru/post/1782536/


All Articles