jQuery :animated Selector

Beginner
6 min read
Updated: Oct 2026
5 examples
Live preview

What Is :animated?

:animated (since jQuery 1.2) matches elements that are mid-animation right now — any node with a jQuery effects queue in progress. When the effect finishes, the element stops matching.

Remember
$(":animated")                 → every animating element
$("div:animated")              → animating divs only
$("#panel div").filter(":animated")  → faster pattern

$("#box").is(":animated")      → true / false for one element
/* CSS transitions / WAAPI → not matched */
UsePrefer
Animators in a group$("div").filter(":animated")
One element check$("#box").is(":animated")
Start / stop motion.slideToggle() / .stop()

How to Use :animated

Start a jQuery effect, then query which elements are still running at that moment.

  1. Ensure a full jQuery build with the effects module (not a slim custom build).
  2. Start an effect such as .slideToggle(), .fadeIn(), or .animate().
  3. Select candidates with CSS first: $("div") or $("#panel .box").
  4. Narrow with .filter(":animated") (or use $("div:animated") for small demos).
PieceRequired?Role
:animatedYesMatches elements with an active jQuery fx queue
Effects moduleYesWithout it, the selector throws
CSS base selectorRecommendedLets native engines narrow the set first

Pseudocode

Pseudocode
candidates = find(cssSelector)   // e.g. all divs
matches = empty list

for each element in candidates:
    if element has active jQuery animation:
        add element to matches

return jQuery(matches)
// snapshot at call time — not a live subscription

Cheat Sheet

Keep these facts handy while working with mid-animation queries.

TopicDetail
Syntax$(":animated") / $("div:animated")
Faster form$("div").filter(":animated")
Single check$("#el").is(":animated")
TimingSnapshot when the selector runs
Counts as animatedjQuery fx only (.animate, slide, fade, …)
Does not countCSS transitions / Web Animations API
SincejQuery 1.2 (effects module required)

Live Preview

Start a looping slideToggle on #mover, then check which sample divs match :animated.

Sample DOM: one looping box (#mover) and one static box. Click Start, then Check while it slides.

Result
Click Start, then Check while #mover is sliding.

$("div:animated")
matched: 0
ids: (none)

jQuery Examples

Short, copy-ready snippets. Open a browser with jQuery loaded, or use Try It Yourself for a live editor.

Example 1 — Official Demo: List div:animated

While #mover loops with slideToggle, click to list which divs are mid-animation.

jQuery
$("#run").on("click", function () {
  var ids = $("div:animated").map(function () {
    return this.id || "(no id)";
  }).get().join(", ");
  console.log("animated:", ids || "(none)");
});

function animateIt() {
  $("#mover").slideToggle("slow", animateIt);
}
animateIt();
Try It Yourself

How It Works

  1. Start a loop. slideToggle with a completion callback restarts itself on #mover.
  2. Query on click. $("div:animated") is a snapshot of animating divs at that instant.
  3. Map ids. Only elements currently in the fx queue appear in the list.
  4. Static stays out. The second div never matches because it never animates.

Example 2 — Test One Element with .is(":animated")

Ask a single element whether it is mid-animation without scanning the whole page.

jQuery
$("#mover").slideToggle("slow");

$("#check").on("click", function () {
  console.log("#mover animated?", $("#mover").is(":animated"));
  console.log("#static animated?", $("#static").is(":animated"));
});
Try It Yourself

How It Works

  1. Animate one box. slideToggle puts #mover into the fx queue.
  2. Boolean check. .is(":animated") returns true or false for that element.
  3. Compare. #static stays false because nothing is running on it.
  4. When to use. Guard logic like “do not start a new effect if one is already running.”

Example 3 — Faster Pattern: .filter(":animated")

Official performance tip: select with CSS first, then filter for animation state.

jQuery
$("#box-a, #box-b").slideToggle("slow");

$("#run").on("click", function () {
  var n = $("#demo div").filter(":animated").length;
  console.log("animating in #demo:", n);
});
Try It Yourself

How It Works

  1. CSS first. $("#demo div") can use native selector speed.
  2. Then filter. .filter(":animated") keeps only nodes with an active fx queue.
  3. Why it helps. Bare $(":animated") cannot use querySelectorAll.
  4. Official advice. This two-step form is the recommended pattern on larger pages.

Example 4 — After .stop(), Nothing Matches

Stopping an effect clears the queue, so :animated becomes empty.

jQuery
$("#mover").slideToggle(2000);

$("#stop").on("click", function () {
  $("#mover").stop(true, true);
  console.log("after stop:", $("div:animated").length);
});
Try It Yourself

How It Works

  1. Start a long slide. A 2000 ms toggle keeps #mover animated for a while.
  2. Stop hard. .stop(true, true) clears the queue and jumps to the end state.
  3. Re-query. With no active fx, $("div:animated").length is 0.
  4. Takeaway. Matching depends on jQuery’s queue — not on visible motion alone.

Example 5 — Count Animating Elements

Use .length as a quick diagnostic while several effects run.

jQuery
$("#a").fadeToggle(800);
$("#b").slideToggle(800);

$("#run").on("click", function () {
  console.log("animating:", $(":animated").length);
});
Try It Yourself

How It Works

  1. Start two effects. Fade and slide run on different elements at once.
  2. Universal animated query. $(":animated") collects every mid-fx node.
  3. Read length. The count equals how many effects are still in progress.
  4. Demo tip. On large pages, prefer $("#area *").filter(":animated") instead.

Edge Cases & Pitfalls

Check these before relying on :animated in real projects.

module

Needs the effects module

A custom jQuery build without effects throws when :animated runs. Use a standard build that includes effects.

css

CSS motion is invisible to it

CSS transitions and the Web Animations API do not set jQuery’s fx flag. Only jQuery effects match.

timing

Snapshot, not a live stream

The selector reports state at call time. Between recursive slideToggle cycles the match set can briefly be empty.

perf

Bare $(":animated") is slower

Because it is a jQuery extension, prefer $("div").filter(":animated") so the first pass can use native CSS selection.

Browser Support

The :animated selector ships with jQuery 1.2+ and the standard effects module. It is a jQuery extension — not native CSS — so support follows your jQuery build, not a CSS feature table.

✓ jQuery 1.2+ · Effects module

jQuery :animated

Works in every browser that runs full jQuery with effects. No native querySelectorAll(':animated'). Slim custom builds without effects throw.

100% With full jQuery + effects
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
:animated jQuery fx

Bottom line: Use a standard jQuery build that includes effects. For speed, select with CSS first, then .filter(":animated"). Do not expect CSS transitions to match.

Performance Notes

ApproachCostBest for
$("div").filter(":animated")CSS pass + filterRecommended (official tip)
$("#el").is(":animated")One elementGuards / single checks
$(":animated")Full Sizzle scanSmall demos only

Official docs: because :animated is not CSS, it cannot use querySelectorAll. Narrow with a pure CSS selector first, then filter.

Key Takeaways

  • Role: match elements with an active jQuery animation queue.
  • Speed: use $("sel").filter(":animated"), not bare $(":animated").
  • Scope: jQuery fx only — not CSS transitions.
  • Build: requires the effects module or the selector throws.

One line: :animated snapshots jQuery mid-effects — filter after a CSS selector for best results.

Frequently Asked Questions

:animated matches every element that is actively running a jQuery animation at the exact moment the selector executes. When the animation finishes, the element no longer matches until a new effect starts.
Any element with a jQuery effects queue in progress — .slideToggle(), .fadeIn(), .show('slow'), .animate(), and similar methods from the effects module. Pure CSS transitions or Web Animations API animations are not tracked by :animated.
jQuery tracks animation state internally when effects run. A custom slim build without the effects module has no animation registry, so :animated throws an error when used.
Because :animated is a jQuery extension, not standard CSS, it cannot use the browser's native querySelectorAll speed boost. Pick elements with a pure CSS selector first, then narrow with .filter(':animated').
Yes. Combine a tag with the pseudo: $("div:animated") matches only div elements that are animating. The official demo uses $("div:animated") on a click handler.
Only while the slide is running. In a recursive slideToggle loop, the element matches during each transition and stops matching briefly when the slide completes before the next toggle starts.

Next: :button Selector

Select button elements and input type="button" controls in one query.

:button tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful