Selecting Elements That Are Currently Animating - J Query

Problem
You need to select elements based on whether they’re animating.

Solution

jQuery offers a convenient filter for this very purpose. The :animated filter will match only elements that are currently animating:

This selector would select all <div>elements currently animating. Effectively, jQueryis selecting all elements that have a nonempty animation queue.

Discussion

This filter is especially useful when you need to apply a blanket function to all elements that are not currently animated. For example, to begin animating all <div>elements that are not already animating, it’s as simple as this:

Sometimes you might want to check whether an element is animating. This can be done with jQuery’s useful is() method:



All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

J Query Topics