For running Cucumber specs with Capybara and Selenium, I need to be able to determine if certain JQuery effects have completed before I can continue with the next step. Is there a generic way to determine if JQuery is still executing effects (e.g. something like $.effects.active.size == 0
)?
Asked
Active
Viewed 2,643 times
15

Pascal Lindelauf
- 4,782
- 4
- 40
- 55
-
1checking ":animated" selector? http://api.jquery.com/animated-selector/ – Marek Sebera Jul 12 '11 at 09:17
2 Answers
9
You can check if element is used by some animation plugin/feature via checking :animated
selector
according to this: http://api.jquery.com/animated-selector/
like this:
$("#el").is(":animated")
more info: How do I find out with jQuery if an element is being animated?

Community
- 1
- 1

Marek Sebera
- 39,650
- 37
- 158
- 244
-
8Yes! And `$(":animated").length == 0` will then determine if all animations have finished. Very cool. Thanks, Marek. – Pascal Lindelauf Jul 12 '11 at 09:40
3
As an alternative option (maybe it will suit somebody else needs), it's possible to completely disable the animations on page (until the is refreshed) by applying:
$('body').append('<style> * {transition: none!important;}</style>')

Johnny
- 14,397
- 15
- 77
- 118