jQuery .stop() Method

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

What Is .stop()?

.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]).

Remember
$("#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(); }
);
NeedUse
Halt mid-animation.stop()
Halt + drop queued steps.stop(true)
Halt, clear queue, snap to end.stop(true, true)
Complete current and queued ends.finish()
Clear queue only (keep running).clearQueue()

How to Use .stop()

Pick the flags that match what should happen to the active tween and the rest of the fx queue.

  1. Start an animation with .animate(), .fadeIn(), .slideUp(), etc.
  2. Call .stop() on the same element when you need to interrupt it.
  3. Set clearQueue if later queued steps should never run.
  4. Set jumpToEnd if the element should jump to the current step’s target CSS.
  5. On hover/click storms, prefer .stop(true, true) before starting a new effect.
ArgumentDefaultRole
clearQueuefalseRemove remaining animations from the queue
jumpToEndfalseComplete the current animation immediately (fires its callback)
queue"fx"Named queue to stop (string form since 1.7)

Pseudocode

Pseudocode
if animation is running on element:
    stop the current tween

    if jumpToEnd:
        set CSS to that tween's final values
        run that tween's complete callback
    else:
        leave CSS where it is
        do NOT run complete

    if clearQueue:
        discard remaining queued animations
    else:
        start the next queued animation now

Cheat Sheet

Quick facts while debugging animation queues.

TopicDetail
ReturnsjQuery (chainable)
Since1.2 · queue-name overload 1.7
.stop()Freeze · next queue item runs
.stop(true)Freeze · clear remaining queue
.stop(true, true)Jump to end · clear remaining queue
vs .finish().finish() also applies queued steps’ end CSS
Hover tip.stop(true, true) before fade/slide

Live Preview

Animate a box, then try different .stop() flag combinations.

Runs in the browser — watch the box and the status line.

Status
Ready — pick an action and click Run.

jQuery Examples

Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.

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.
  4. Back. A new animation can start from the frozen position.

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.
  4. Result. Later margins never apply.

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.
  4. Queue. With clearQueue: false, later steps can still follow.

Example 4 — Hover Fade Guard

Official pattern: clear and finish before starting the opposite fade.

jQuery
$("#hover-zone").hover(
  function () {
    $("#fade-target").stop(true, true).fadeOut(300);
  },
  function () {
    $("#fade-target").stop(true, true).fadeIn(300);
  }
);
Try It Yourself

How It Works

  1. Problem. Fast mouse moves queue many fades.
  2. Guard. .stop(true, true) clears and finishes the active one.
  3. Fade. Only the new intentional fade runs.
  4. UX. Opacity tracks the pointer instead of catching up later.

Example 5 — .stop() Before slideToggle

Interrupt a toggle and reverse from the current height (jQuery 1.7+ tracking).

jQuery
var $block = $("#panel");

$("#toggle").on("click", function () {
  $block.stop().slideToggle(1000);
});
Try It Yourself

How It Works

  1. Toggle. slideToggle opens or closes over 1 s.
  2. Stop. Mid-click freezes the current height briefly.
  3. Reverse. The next toggle goes the other way from that point.
  4. 1.7+. Internal toggle state stays consistent after a premature stop.

Edge Cases & Pitfalls

Common surprises when stopping animations.

callback

Complete only with jumpToEnd

Plain .stop() does not fire the current step’s complete callback.

queue

Default stop starts the next item

Without clearQueue, the next queued animation begins immediately after the halt.

finish

.stop(true, true) ≠ .finish()

.finish() applies end CSS for queued steps too; .stop(true, true) never runs those steps.

hover

Skip the guard → opacity flicker

Rapid hover without .stop(true, true) stacks fades on the fx queue.

Browser Support

.stop() has been part of jQuery since 1.2 (queue-name overload since 1.7). It works wherever your loaded jQuery version runs effects.

✓ Stable · jQuery 1.2+

.stop()

Works in every browser that runs your loaded jQuery version. Prefer a current jQuery 3.x build for modern projects.

100% With 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
.stop() Universal

Bottom line: Safe for production UI. Use .stop(true, true) on interactive hover/click effects to keep the fx queue under control.

Performance Notes

ApproachCostBest for
.stop() / .stop(true, true)TinyInterrupting one element’s tween
Queued fades without stopHigherAvoid on hover — backlog burns frames
Many elements + long queuesHigherClear queues; prefer shorter durations

Stopping is cheap. The expensive part is letting unused animations pile up — clear them early on busy interaction paths.

Key Takeaways

  • Role: halt the active animation on matched elements.
  • Flags: clearQueue drops pending steps; jumpToEnd snaps + fires complete.
  • Hover: use .stop(true, true) before fade/slide on enter/leave.
  • vs finish: .finish() also applies queued end states; .stop(true, true) does not.

One line: .stop() interrupts the current tween — add flags to clear the queue and/or jump to the end.

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

See how finishing differs from stopping with jumpToEnd.

.finish() 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.

8 people found this page helpful