jQuery .stop() Method

Beginner
⏱️ 9 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Queue Control

What You’ll Learn

The .stop() instance method stops the currently-running animation on matched elements. This tutorial covers both overloads since jQuery 1.2 and 1.7 (including the optional queue name), clearQueue and jumpToEnd defaults, comparisons with .stop(true, false), .stop(true, true), .finish(), and .clearQueue(), the hover-fade guard pattern, and five hands-on examples from the official jQuery API.

01

Halt tween

Freeze mid-animation

02

clearQueue

Drop pending steps

03

jumpToEnd

Skip to target CSS

04

Two overloads

1.2 / 1.7 queue arg

05

No callback

Unless jumpToEnd true

06

Hover guard

stop(true,true) fades

Introduction

Chained .animate(), .fadeIn(), and .slideToggle() calls enqueue on jQuery’s fx queue. When a user clicks rapidly or moves the mouse in and out, animations stack — elements flicker, overshoot, or finish in the wrong state.

Available since jQuery 1.2, .stop() halts the animation currently running on matched elements. With default arguments the element freezes at its in-progress CSS and the next queued animation starts immediately. Pass true for clearQueue to discard pending steps, or add a second true for jumpToEnd to snap the active tween to its target values and fire its callback.

Understanding the .stop() Method

Per the official jQuery API, .stop() stops the currently-running animation on the matched elements. When called with no arguments, the element remains at its current in-progress CSS values — not the animation’s end state. The completion callback for the halted step does not run unless jumpToEnd is true.

Since jQuery 1.7, the first argument can be a queue name string (default "fx") instead of a boolean. Toggled effects such as .slideToggle() and .fadeToggle() may leave an element mid-animation; calling .stop() before starting a new toggle prevents conflicting queued tweens from running afterward.

💡
Beginner Tip

Think of .stop() as a pause button on the fx queue. .stop(true, true) is the emergency brake — clear everything waiting and jump the current animation to its destination before starting something new.

📝 Syntax

Two overloads of .stop:

jQuery
// 1) clearQueue and jumpToEnd — since jQuery 1.2
jQuery( selector ).stop( [clearQueue ] [, jumpToEnd ] )
// 2) Queue name, clearQueue, jumpToEnd — since jQuery 1.7
jQuery( selector ).stop( [queue ] [, clearQueue ] [, jumpToEnd ] )

Parameters

  • queue (String, default "fx", since 1.7) — name of the queue whose animations to stop.
  • clearQueue (Boolean, default false) — when true, removes the rest of the animations queued on the specified queue.
  • jumpToEnd (Boolean, default false) — when true, the current animation jumps immediately to its end state and its completion callback is invoked.

Return value

  • A jQuery object for chaining further methods on the same set.

Official jQuery API description

jQuery
// Stop the currently-running animation:
$( "#stop" ).on( "click", function() {
  $( ".block" ).stop();
});

⚡ Quick Reference

GoalCode
Halt at current CSS; next queued step runs$el.stop()
Clear pending queue; freeze in-progress tween$el.stop(true) or $el.stop(true, false)
Clear queue + jump current to end + callback$el.stop(true, true)
Jump current step only; keep queue$el.stop(false, true)
Hover fade guard before fadeIn/fadeOut$img.stop(true, true).fadeIn("slow")
Stop before toggled effect since 1.7$block.stop().slideToggle(1000)

📋 .stop() vs stop(true,false) vs stop(true,true) vs finish vs clearQueue

Five ways to interrupt the fx pipeline — only .finish() applies end CSS for every queued animation step, not just the current one.

.stop()
$el.stop()

Halts the active tween at in-progress CSS — next queued animation starts immediately; no callback fires

.stop(true, false)
$el.stop(true, false)

Clears pending queue items and freezes the current animation mid-tween — neither end state nor queued targets apply

.stop(true, true)
$el.stop(true, true)

Clears queue and jumps the current animation to its end CSS with callback — queued steps never run

.finish()
$el.finish()

Since 1.9 — stops current animation and jumps every queued step to its end CSS before removing the queue

.clearQueue()
$el.clearQueue()

Removes pending queue items only — does not stop the animation currently running or change CSS

Examples Gallery

Each example demonstrates an official jQuery API .stop() pattern or a common real-world guard. Open DevTools or use the Try-it links. Examples 1 and 2 mirror live demos on api.jquery.com/stop/.

📚 Getting Started

Official jQuery API demos — Go/STOP/Back animate controls and slideToggle with .stop() before toggling.

Example 1 — Go / STOP / Back: .block .animate() with .stop() (Official Example 1)

Click Go to animate .block right over 2000 ms. Click STOP to call .stop() mid-flight — the block freezes at its current position. Click Back to animate left again.

jQuery
$( "#go" ).on( "click", function() {
  $( ".block" ).animate({ left: "+=100px" }, 2000 );
} );
$( "#stop" ).on( "click", function() {
  $( ".block" ).stop();
} );
$( "#back" ).on( "click", function() {
  $( ".block" ).animate({ left: "-=100px" }, 2000 );
} );
Try It Yourself

How It Works

Plain .stop() uses defaults clearQueue: false and jumpToEnd: false. The tween halts wherever it was when STOP was clicked. The animate callback does not fire. Any queued animation would start next — here there is none, so the block simply waits for Back.

Example 2 — $block.stop().slideToggle(1000) Before Toggling (Official Example 2)

Click a toggle button to call .stop() on .block before .slideToggle(1000). Since jQuery 1.7, this pattern prevents half-finished slide toggles from stacking in the queue.

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

How It Works

Toggled animations may leave an element mid-slide. Without .stop(), each click enqueues another toggle while the previous one still runs. .stop() halts the active tween at its current height, then .slideToggle(1000) picks the correct direction from that state.

📈 Advanced Patterns

Hover fade guards, clearQueue-only stops, and jumpToEnd for snapping the active tween to its target CSS.

Example 3 — Hover Fade Guard: stop(true, true) on mouseenter / mouseleave

On image hover, call .stop(true, true) before .fadeIn("slow") on mouseenter and before .fadeOut("slow") on mouseleave. Both flags clear the queue and jump the current fade to its end opacity.

jQuery
$( "img" )
  .on( "mouseenter", function() {
    $( this ).stop( true, true ).fadeIn( "slow" );
  } )
  .on( "mouseleave", function() {
    $( this ).stop( true, true ).fadeOut( "slow" );
  } );
Try It Yourself

How It Works

The first true clears pending fades on the fx queue. The second jumps the in-progress opacity tween to fully visible or hidden before the new fade starts. Without both flags, half-finished fades stack and the image flickers between intermediate opacities.

Example 4 — stop(true) clearQueue: Drop Pending Chained Animations

Queue three slow .animate() steps on Go. Click Stop to call .stop(true) — equivalent to .stop(true, false) — which clears pending steps and freezes the block at its in-progress position.

jQuery
$( "#go-chain" ).on( "click", function() {
  $( ".block" )
    .animate({ left: "+=150px" }, 3000 )
    .animate({ top: "+=80px" }, 3000 )
    .animate({ width: "+=40px" }, 3000 );
} );
$( "#stop-chain" ).on( "click", function() {
  $( ".block" ).stop( true );
} );
Try It Yourself

How It Works

clearQueue: true removes every animation waiting on the fx queue. The active tween stops at in-progress CSS — not its target. Steps 2 and 3 never execute because they were discarded from the queue, not jumped to their end values.

Example 5 — stop(false, true) jumpToEnd: Snap Current Animation to Target CSS

Start a long horizontal .animate(). Call .stop(false, true) mid-flight to jump the current step to its end left value immediately and invoke its completion callback — without clearing queued follow-up steps.

jQuery
$( "#go-jump" ).on( "click", function() {
  $( ".block" )
    .animate({ left: "+=200px" }, 4000, function() {
      $( "#msg" ).text( "First animate complete." );
    } )
    .animate({ top: "+=60px" }, 2000 );
} );
$( "#jump-end" ).on( "click", function() {
  $( ".block" ).stop( false, true );
} );
Try It Yourself

How It Works

With clearQueue: false, pending queue items remain. jumpToEnd: true completes only the active animation — CSS jumps to the target left and the first callback runs. Because the queue was not cleared, the second .animate({ top }) begins immediately afterward.

🚀 Common Use Cases

  • Rapid toggle buttons — call .stop() before .slideToggle() or .fadeToggle() so mid-animation clicks do not stack conflicting tweens.
  • Hover image fades — guard mouseenter/mouseleave with .stop(true, true) before .fadeIn() / .fadeOut().
  • Cancel user-initiated motion — pair Go and Stop buttons on draggable or sliding UI, as in the official API demo.
  • Abort chained animate paths.stop(true) drops pending path segments when the user interrupts a multi-step animation.
  • Skip to current step end.stop(false, true) when you need the active tween’s callback without waiting for the full duration.
  • Named queue control since 1.7 — pass a queue string as the first argument to stop animations on custom queues only.

🧠 How .stop() Halts an Animation

1

Animation is running

An effect or .animate() step is actively tweening CSS on the matched element. Additional steps may wait on the fx queue.

Prerequisite
2

.stop() is invoked

jQuery halts the active tween immediately. With default flags the element freezes at in-progress CSS values — not the animation target.

Halt
3

Queue flags apply

clearQueue: true removes pending steps. jumpToEnd: true snaps the current step to target CSS and fires its callback. Both can combine as .stop(true, true).

Flags
4

Next step or idle

If the queue was not cleared and a step remains, it starts next. Otherwise the element is idle at its current or jumped-to CSS — ready for a fresh animation chain.

📝 Notes

  • Available since jQuery 1.2; queue name overload added in 1.7; works alongside toggled effects such as .slideToggle() and .fadeToggle().
  • clearQueue defaults to false; jumpToEnd defaults to false.
  • Stops mid-animation at current CSS unless jumpToEnd is true — the element does not snap to the target end state by default.
  • Completion callbacks are not invoked when stopped unless jumpToEnd is true.
  • When clearQueue is false, the next queued animation starts after the halt. When true, pending steps are removed.
  • Since jQuery 1.7, pass a queue name string as the first argument: .stop("fx", true, true) or .stop("customQueue", true).
  • For toggled animations, call .stop() before starting a new toggle so half-finished show/hide tweens do not conflict in the queue.

Browser Support

.stop() is a jQuery instance method since 1.2+ (queue name overload since 1.7+). It operates on jQuery’s internal fx engine — behavior is consistent wherever jQuery runs, independent of CSS transition support.

Stable · jQuery 1.2+

jQuery .stop()

Supported in all jQuery 1.x, 2.x, 3.x, and 4.x releases. Works in Chrome, Firefox, Safari, Edge, IE 6+ (with compatible jQuery builds), and Node.js via jsdom.

100% jQuery stop API support
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: Learn .stop() alongside .finish(), .clearQueue(), and .queue() to master animation interruption and the full fx pipeline.

Conclusion

The .stop() method is jQuery’s primary tool for halting running animations. Two overloads cover simple boolean flags and optional queue names since 1.7.

Default .stop() freezes at in-progress CSS and lets the queue continue. Add true arguments to clear pending steps or jump the active tween to its end state. Pair this method with .slideToggle() behind you and .finish() ahead when you need every queued step’s target CSS applied.

💡 Best Practices

✅ Do

  • Call .stop() before .slideToggle() or .fadeToggle() on rapid-click handlers
  • Use .stop(true, true) before hover .fadeIn() / .fadeOut() pairs
  • Pass a queue name string when stopping custom named queues since jQuery 1.7
  • Use .stop(false, true) when you need the current step’s callback without waiting
  • Reach for .finish() when queued steps’ end CSS must still apply

❌ Don’t

  • Expect the complete callback after plain .stop() — it does not fire unless jumpToEnd is true
  • Confuse .stop(true, true) with .finish() — only finish applies all queued end states
  • Assume .clearQueue() stops the active animation — pair it with .stop() when needed
  • Stack rapid fades without .stop(true, true) — opacity tweens flicker and backlog
  • Forget toggled-animation guards since 1.7 — mid-toggle elements need .stop() before a new toggle

Key Takeaways

Knowledge Unlocked

Five things to remember about .stop()

Halt running animations and control what happens to the fx queue next.

5
Core concepts
02

clearQueue flag

Drop pending steps

API
🔄 03

jumpToEnd flag

Target CSS + cb

Timing
📝 04

No callback

Unless jumpToEnd

Callback
👁 05

Hover guard

stop(true,true)

Pattern

❓ Frequently Asked Questions

.stop() stops the currently-running animation on matched elements. The element freezes at its in-progress CSS values unless jumpToEnd is true. By default clearQueue is false, so the next queued animation on the fx queue starts immediately after the halt.
Since jQuery 1.2: .stop([clearQueue] [, jumpToEnd]). Since jQuery 1.7: .stop([queue] [, clearQueue] [, jumpToEnd]) — the first argument can be a queue name string such as "fx" instead of a boolean.
clearQueue (default false) removes the rest of the animation queue when true — no further queued steps run. jumpToEnd (default false) jumps the current animation to its target CSS immediately and fires its completion callback when true. Use .stop(true, true) to clear pending steps and snap the active tween to its end state.
No — unless jumpToEnd is true. A plain .stop() or .stop(true) freezes or clears without invoking the current step's complete callback. .stop(false, true) or .stop(true, true) completes the active animation to its end values and runs the callback for that step only.
.clearQueue() removes pending queue items but does not stop the animation currently running. .stop() halts the active tween. .stop(true, true) clears the queue and jumps the current step to its end CSS but never applies queued steps' target values. .finish() (since 1.9) completes the current animation and every queued step to their end CSS.
On rapid hover or click handlers — call .stop(true, true) before starting a new fadeIn on mouseenter or fadeOut on mouseleave. That clears stacked opacity tweens and jumps to the end state so half-finished fades do not queue up and flicker.
Did you know?

The official jQuery .stop() slideToggle demo calls $block.stop().slideToggle(1000) on every click. Since jQuery 1.7, toggled effects can leave elements mid-animation — stopping first prevents a backlog of half-finished slides from fighting each other when users click the toggle button rapidly. The same .stop()-before-toggle pattern applies to .fadeToggle() and other visibility toggles on the fx queue.

Continue to .finish()

Jump current and all queued animations to their end CSS — when .stop(true, true) is not enough.

.finish() →

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.

6 people found this page helpful