How to know if all animations are complete
I am trying to create a jquery input box and I want to show one form only if all other animations are complete.
I realize I can do multiple checks .is(':animated')
, but I was wondering if there is a way to select all animated objects and check if I have selected exactly zero elements?
+3
source to share
1 answer
if ($(":animated").length === 0) {
// do something
}
As per Jasper's comment and what it says in the :animated
doco selector , you can improve performance by selecting the container element or otherwise narrowing the field before use :animated
. For example.
if ($("#container").find(":animated").length === 0) {
// OR
if ($(".someClass").filter(":animated").length === 0) {
+7
source to share