Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining if JQuery effects are still executing

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)?

like image 831
Pascal Lindelauf Avatar asked Jul 12 '11 09:07

Pascal Lindelauf


2 Answers

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?

like image 164
Marek Sebera Avatar answered Oct 31 '22 18:10

Marek Sebera


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>')
like image 3
Johnny Avatar answered Oct 31 '22 17:10

Johnny