jQuery .stop() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
Effects

Definition

.stop([clearQueue] [, jumpToEnd]) stops the currently-running animation on matched elements (since 1.2). Since 1.7 you can also target a named queue: .stop([queue] [, clearQueue] [, jumpToEnd]).

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$("#box").stop();              // freeze current tween
$("#box").stop(true);          // freeze + clear remaining queue
$("#box").stop(true, true);    // clear queue + jump to end CSS
$("#box").stop("fx", true, true); // same, named queue (1.7+)

// Hover-safe fade (official pattern)
$("#hover").hover(
  function () { $(this).find("img").stop(true, true).fadeOut(); },
  function () { $(this).find("img").stop(true, true).fadeIn(); }
);
CallWhat it does
clearQueueRemove remaining animations from the queue
jumpToEndComplete the current animation immediately (fires its callback)
queueNamed queue to stop (string form since 1.7)

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Start an animation with .animate(), .fadeIn(), .slideUp(), etc.
Step 2Call .stop() on the same element when you need to interrupt it.
Step 3Set clearQueue if later queued steps should never run.

Return Value

Return ValueDescription
Value / undefinedGetters usually return a value from the first matched element, or undefined when nothing applies.

jQuery Examples

Example 1 — Stop Mid-Animation

Start a long move, then freeze it where it is.

jQuery
$("#go").on("click", function () {
  $("#box").animate({ marginLeft: 160 }, 2000);
});

$("#stop").on("click", function () {
  $("#box").stop();
});

$("#back").on("click", function () {
  $("#box").animate({ marginLeft: 0 }, 2000);
});
Try It Yourself

How It Works

  1. Go. .animate() starts a 2000 ms margin tween.
  2. Stop. Plain .stop() freezes CSS mid-way.
  3. No jump. Target margin is not applied unless jumpToEnd is true.

Example 2 — Clear the Queue

Queue several steps, then decide whether later ones should still run.

jQuery
$("#box")
  .animate({ marginLeft: 80 }, 800)
  .animate({ marginLeft: 160 }, 800)
  .animate({ marginLeft: 240 }, 800);

// Later — drop remaining steps, keep current freeze
$("#box").stop(true);
Try It Yourself

How It Works

  1. Queue. Each chained .animate() waits its turn on fx.
  2. Halt. .stop() ends only the active tween.
  3. Clear. clearQueue: true removes the rest.

Example 3 — Jump to End

Snap the current tween to its final CSS and fire its callback.

jQuery
$("#box").animate({ opacity: 0.2 }, 2000, function () {
  $("#status").text("complete fired");
});

// Snap opacity to 0.2 and run complete
$("#box").stop(false, true);
Try It Yourself

How It Works

  1. Animate. Opacity heads toward 0.2 over 2 s.
  2. Jump. jumpToEnd: true applies the target now.
  3. Callback. That step’s complete runs immediately.

Frequently Asked Questions

.stop() immediately stops the currently-running animation on matched elements. By default the element freezes at its in-progress CSS values. If clearQueue is false (default), the next queued animation starts right away.
clearQueue (default false) removes remaining animations from the queue when true. jumpToEnd (default false) snaps the current animation to its target CSS and runs its complete callback when true. .stop(true, true) clears the queue and finishes the active step.
No — unless jumpToEnd is true. A plain .stop() freezes without calling the current step’s complete handler. With jumpToEnd true, the callback for that active step runs after the snap-to-end.
.stop(true, true) clears pending queue items and jumps only the current animation to its end CSS — queued steps never apply. .finish() (since 1.9) completes the current animation and every queued animation to their final CSS values.
On rapid hover or click handlers before starting a new fadeIn / fadeOut / slide. It clears stacked tweens and jumps to the end state so half-finished effects do not queue up and flicker.
You can pass a queue name string as the first argument: .stop(queue, clearQueue, jumpToEnd). Also, stopping a toggled animation mid-flight keeps better internal toggle state than older versions did.

Next: .finish() Method

See how finishing differs from stopping with jumpToEnd.

.finish() Method tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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.

8 people found this page helpful