jQuery .finish() Method

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

What You’ll Learn

The .finish() instance method stops the currently-running animation, removes all queued animations, and jumps every matched element to the final CSS values of each queued step. This tutorial covers syntax since jQuery 1.9, the default fx queue name, comparisons with .stop(true, true), .stop(true, false), .clearQueue(), and .clearQueue().finish(), and five hands-on examples from the official jQuery API plus side-by-side and chained-effect patterns.

01

Stop current

Halt in-progress tween

02

Clear queue

Remove pending steps

03

All end CSS

Key diff from stop

04

Since 1.9

Queue finish API

05

fx queue

Optional queue name

06

$.fx.off

Global effect disable

Introduction

Chained jQuery effects — three .animate() calls, a .fadeToggle() sequence, or rapid user clicks — enqueue steps on the default fx queue. Sometimes you need to abort everything instantly and land on the final visual state, not freeze mid-tween or leave half the chain pending.

Available since jQuery 1.9, .finish() does exactly that. It stops the animation currently running, removes every queued animation, and sets CSS properties to the target values of the current step and every queued step. That last detail separates .finish() from .stop(true, true), which clears the queue and jumps the active animation but never applies the end CSS of animations still waiting in line.

Understanding the .finish() Method

Per the official jQuery API, .finish() stops the currently-running animation, removes all queued animations, and completes all animations for the matched elements. When called on an element, the active tween and every queued animation immediately stop; CSS properties jump to their target values for each step, and all queued functions are removed.

If the optional queue name argument is provided, only animations in that named queue are finished. Without it, jQuery targets the default fx effects queue — the same pipeline used by .show(), .animate(), .fadeToggle(), and other effect methods.

💡
Beginner Tip

Think of .finish() as “skip to the end of the entire animation playlist.” .stop(true, true) skips the current song and clears the playlist without playing the rest; .finish() fast-forwards through every remaining track to its final frame.

📝 Syntax

One overload of .finish:

jQuery
// Optional queue name - since jQuery 1.9
jQuery( selector ).finish( [queue ] )

Parameters

  • queue (String, default "fx") — the name of the queue whose animations should be stopped and completed. Pass a custom queue name when finishing non-default pipelines created with .queue("tasks", fn).

Return value

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

Official jQuery API description

jQuery
// Click Go to chain three .animate() steps; click Finish to jump to final position:
$( "#go" ).on( "click", function() {
  $( ".box" )
    .clearQueue()
    .stop()
    .css({ left: 10, top: 10 })
    .animate({ top: vert }, 3000 )
    .animate({ left: horiz }, 3000 )
    .animate({ top: 10 }, 3000 );
} );
$( "#finish" ).on( "click", function() {
  $( ".box" ).finish();
} );

⚡ Quick Reference

GoalCode
Finish default fx queue$el.finish()
Finish a named queue$el.finish("tasks")
Abort chained animates to final CSS$el.animate(...).animate(...).finish()
Reset then finish mid-chain$el.clearQueue().finish()
Finish after rapid fadeToggle clicks$panel.finish("fx")
Disable all effects globallyjQuery.fx.off = true

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

Five ways to interrupt the fx queue — only .finish() and .clearQueue().finish() apply end CSS for every queued animation step.

.finish()
$el.finish()

Stops current animation, removes queue, jumps current and all queued steps to their end CSS values

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

Clears queue and jumps current animation to end state — queued animations never run, so their target CSS is not applied

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

Clears queue but leaves current animation frozen at its in-progress CSS values — neither current nor queued end states complete

.clearQueue()
$el.clearQueue()

Removes pending queue items only — does not stop the animation currently running or apply any end CSS

.clearQueue().finish()
$el.clearQueue().finish()

Clears pending items first, then finishes the active animation to its end state — useful when custom queue callbacks mix with effects

Examples Gallery

Each example demonstrates an official jQuery API .finish() pattern or a common real-world use case. Open DevTools or use the Try-it links. Example 1 mirrors the path demo on api.jquery.com/finish/.

📚 Getting Started

Official jQuery API demo — chain three .animate() steps on a path, then call .finish() to jump the box to its final position.

Example 1 — Official Demo: Path Chain with .finish() (Official API)

Click Go to reset the box and chain three slow .animate() steps down, right, and back up. While the chain runs, click Finish to call .finish() — the box immediately jumps to the final top-left position with all queued steps completed.

jQuery
var horiz = $( "#path" ).width() - 20,
    vert = $( "#path" ).height() - 20;
$( "#go" ).on( "click", function() {
  $( ".box" )
    .clearQueue()
    .stop()
    .css({ left: 10, top: 10 })
    .animate({ top: vert }, 3000 )
    .animate({ left: horiz }, 3000 )
    .animate({ top: 10 }, 3000 );
} );
$( "#finish" ).on( "click", function() {
  $( ".box" ).finish();
} );
Try It Yourself

How It Works

Each .animate() enqueues on fx. Mid-chain, .finish() stops the active tween, fast-forwards every remaining step to its target CSS (top: 10, left: horiz, then top: 10), and empties the queue. The box ends at the same position as if all three animations had played to completion.

Example 2 — .finish() vs .stop(true, true) Side by Side

Two boxes run the same three-step path chain. Click Finish on the left box and stop(true,true) on the right to see the critical difference: .finish() applies end CSS for all queued steps; .stop(true, true) only jumps the current step.

jQuery
function startPath( selector ) {
  $( selector )
    .clearQueue().stop()
    .css({ left: 10, top: 10 })
    .animate({ top: 200 }, 3000 )
    .animate({ left: 300 }, 3000 )
    .animate({ top: 10 }, 3000 );
}
$( "#go-both" ).on( "click", function() {
  startPath( "#box-finish" );
  startPath( "#box-stop" );
} );
$( "#btn-finish" ).on( "click", function() {
  $( "#box-finish" ).finish();
} );
$( "#btn-stop" ).on( "click", function() {
  $( "#box-stop" ).stop( true, true );
} );
Try It Yourself

How It Works

Both methods clear the queue and halt the active tween. The difference appears in CSS: .finish() simulates completion of every queued animation, so horizontal and vertical targets from steps 2 and 3 still apply. .stop(true, true) jumps only the in-progress step — later queued targets are discarded.

📈 Advanced Patterns

Multi-property chains, clearQueue combinations, and explicit fx queue finishing after fade toggles.

Example 3 — Queued Chain: left, then top, then width

Chain three property animations — left, then top, then width. Call .finish() mid-chain to apply all three end values instantly instead of waiting for each tween sequentially.

jQuery
$( "#start-chain" ).on( "click", function() {
  $( "#chain-box" )
    .clearQueue().stop()
    .css({ left: 0, top: 0, width: 50 })
    .animate({ left: 250 }, 2000 )
    .animate({ top: 120 }, 2000 )
    .animate({ width: 150 }, 2000 );
} );
$( "#finish-chain" ).on( "click", function() {
  $( "#chain-box" ).finish();
} );
Try It Yourself

How It Works

jQuery runs fx steps one at a time. Without .finish(), you would wait up to six seconds for all three tweens. .finish() collapses the entire chain: each queued step’s target properties merge into the element’s final inline style immediately.

Example 4 — .clearQueue().finish() vs .finish() Alone Mid-Animation

Compare calling .finish() alone versus .clearQueue().finish() when a mix of custom queue callbacks and animations is running. The chained form drops non-animation queue items before finishing the active effect.

jQuery
$( "#run-mix" ).on( "click", function() {
  var $box = $( "#mix-box" ).clearQueue().stop().css({ opacity: 1 });
  $box
    .animate({ opacity: 0.3 }, 2000 )
    .queue( function( next ) {
      $( this ).css( "background", "orange" );
      next();
    } )
    .animate({ opacity: 1 }, 2000 );
} );
$( "#finish-alone" ).on( "click", function() {
  $( "#mix-box" ).finish();
} );
$( "#clear-finish" ).on( "click", function() {
  $( "#mix-box" ).clearQueue().finish();
} );
Try It Yourself

How It Works

.finish() alone processes every remaining queue entry — animations and custom .queue(fn) callbacks alike — jumping each to its completion state. .clearQueue().finish() first strips pending items that have not started, then finishes only the currently-running animation to its end CSS. Choose based on whether pending custom queue work should run or be discarded.

Example 5 — .finish("fx") After Multiple Chained .fadeToggle() Steps

Rapid clicks enqueue multiple .fadeToggle() calls on the fx queue. Call .finish("fx") to stop the current fade, complete every queued fade to its end opacity/display state, and clear the pipeline for a clean restart.

jQuery
$( "#spam-toggle" ).on( "click", function() {
  $( "#fade-panel" ).fadeToggle( 600 );
} );
$( "#finish-fx" ).on( "click", function() {
  $( "#fade-panel" ).finish( "fx" );
} );
Try It Yourself

How It Works

Passing "fx" explicitly targets the effects queue (the default when omitted). Each queued .fadeToggle() resolves to its end state — fully faded in with opacity: 1 or faded out with display: none — based on how many toggles were pending. The queue is empty afterward, ready for a fresh animation.

🚀 Common Use Cases

  • Skip intro animations — let users click “Skip” to .finish() a chained entrance sequence and land on the final layout immediately.
  • Cancel in-flight transitions — close a modal or navigate away while a multi-step .animate() path is running; finish applies the end CSS cleanly.
  • Resolve rapid-click queues — after stacked .fadeToggle() or .slideToggle() calls, .finish("fx") settles visibility without flicker.
  • Reset before new animation — call .finish() before starting a fresh effect chain so no stale queued steps interfere.
  • Testing and demos — jump long demo animations to their conclusion without waiting for every tween to play out.
  • Accessibility preferences — pair with jQuery.fx.off or user motion settings to honor reduced-motion by finishing or disabling effects.

🧠 How .finish() Processes the Queue

1

Active animation stopped

The currently-running tween on the specified queue (default fx) halts immediately. Its CSS properties jump to the target values defined for that step.

Current
2

Queued steps completed

Each pending animation on the queue is processed in order. CSS properties for every queued step jump to their end values — the key behavior that separates .finish() from .stop(true, true).

Queued
3

Queue emptied

All animation functions are removed from the queue. No pending steps remain; the element is ready for new effects or callbacks.

Cleanup
4

Final state and chainable return

Matched elements reflect the combined end CSS of all finished steps. .finish() returns the jQuery object for further chaining.

📝 Notes

  • Available since jQuery 1.9; returns a chainable jQuery object.
  • Default queue name is fx when the optional argument is omitted.
  • Similar to .stop(true, true) but also applies end CSS for every queued animation — not just the current one.
  • .stop(true, false) clears the queue but freezes the current animation at in-progress values; .finish() always completes to target CSS.
  • .clearQueue() alone removes pending items without stopping the active animation or applying end states.
  • .clearQueue().finish() drops pending queue functions first, then finishes the currently-running step.
  • Set jQuery.fx.off = true globally to disable all effects; animation methods then immediately set elements to their final state when called.

Browser Support

.finish() is a jQuery instance method since 1.9+. It uses jQuery’s internal fx engine and queue system — behavior is consistent wherever jQuery runs, independent of CSS transition support.

Stable ร‚ยท jQuery 1.9+

jQuery .finish()

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

100% jQuery finish 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
.finish() Universal

Bottom line: Learn .finish() alongside .stop(), .clearQueue(), and .queue() to master animation interruption and the full fx pipeline.

Conclusion

The .finish() method is jQuery’s way to abort animation chains and land on final CSS immediately. One optional queue name targets the default fx pipeline or a custom queue, and the return value stays chainable for further jQuery calls.

Reach for .finish() when you need every queued step’s end state applied — not just the current animation. Compare it with .stop(true, true) when partial completion is enough, and pair it with .clearQueue() when custom queue callbacks need selective removal. Continue to .queue() to inspect and manage the pipeline itself.

💡 Best Practices

✅ Do

  • Use .finish() when you need all queued animation end CSS applied instantly
  • Call .finish() before starting a fresh effect chain after user cancellation
  • Pass "fx" explicitly when documenting or teaching effects-queue behavior
  • Pair with user “Skip animation” controls for long chained sequences
  • Respect jQuery.fx.off or reduced-motion preferences in accessible UIs

❌ Don’t

  • Substitute .stop(true, true) when queued steps’ end CSS must still apply
  • Expect .clearQueue() alone to stop the animation currently running
  • Call .finish() expecting smooth visual transition — it jumps instantly to end values
  • Confuse .finish() with .stop() — only finish completes every queued step
  • Forget that custom .queue(fn) callbacks on fx are also processed by .finish()

Key Takeaways

Knowledge Unlocked

Five things to remember about .finish()

Skip to the end of the entire animation playlist.

5
Core concepts
02

Since 1.9

Queue finish API

API
🔄 03

All end CSS

Diff from stop

Compare
📝 04

fx default

Optional queue name

Syntax
05

$.fx.off

Global disable

Config

❓ Frequently Asked Questions

.finish() stops the currently-running animation on matched elements immediately. The in-progress tween halts and its CSS properties jump to the target values for that step. Unlike .stop() alone, .finish() also processes every queued animation - not just the active one.
Yes. .finish() clears the queue after completing each pending step's end state. All queued animation functions are removed once their final CSS values are applied. Nothing remains waiting on the specified queue.
.stop(true, true) clears the queue and jumps the current animation to its end value - but queued animations never run, so their target CSS is never applied. .finish() is the key difference: it also jumps every queued animation to its end CSS values before removing those steps.
.finish([queue]) accepts an optional string naming which queue to finish. It defaults to "fx" - jQuery's standard effects queue used by .animate(), .fadeToggle(), and similar methods. Pass a custom name like "tasks" to finish only that named queue.
.finish() was added in jQuery 1.9 alongside refined queue-control APIs. It returns a jQuery object for chaining and works on the same fx pipeline as .stop(), .clearQueue(), and .queue().
.finish() is similar to .stop(true, true) in that it clears the queue and jumps the current step to its end state - but .finish() also completes every queued animation's end CSS. Set jQuery.fx.off = true globally to disable all effects; when off, animation methods immediately set elements to their final state without displaying an effect.
Did you know?

.finish() was introduced in jQuery 1.9 as a dedicated answer to a subtle gap in .stop(true, true): clearing the queue and jumping the current animation still left queued animations’ target CSS unapplied. The official API demo on api.jquery.com/finish/ pairs six interrupt buttons side by side so you can compare .finish(), .stop(true, true), .stop(true, false), and .clearQueue() combinations on the same path animation.

Continue to jQuery.fx.interval

Learn how jQuery controls global animation tick rate in legacy browsers.

jQuery.fx.interval →

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