.finish( [queue ] )Returns: jQuery

Description: Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements.

When .finish() is called on an element, the currently-running animation and all queued animations (if any) immediately stop and their CSS properties set to their target values. All queued animations are removed.

If the first argument is provided, only the animations in the queue represented by that string will be stopped.

The .finish() method is similar to .stop(true, true) in that it clears the queue and the current animation jumps to its end value. It differs, however, in that .finish() also causes the CSS property of all queued animations to jump to their end values, as well.

Animations may be stopped globally by setting the property $.fx.off to true. When this is done, all animation methods will immediately set elements to their final state when called, rather than displaying an effect.


Click the Go button once to start the animation, and then click the other buttons to see how they affect the current and queued animations.

<!doctype html>
<html lang="en">
  <meta charset="utf-8">
  <title>finish demo</title>
  .box {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 15px;
    height: 15px;
    background: black;
  #path {
    height: 244px;
    font-size: 70%;
    border-left: 2px dashed red;
    border-bottom: 2px dashed green;
    border-right: 2px dashed blue;
  button {
    width: 12em;
    display: block;
    text-align: left;
    margin: 0 auto;
  <script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<div class="box"></div>
<div id="path">
  <button id="go">Go</button>
  <button id="bstt" class="b">.stop( true,true )</button>
  <button id="bcf" class="b">.clearQueue().finish()</button>
  <button id="bstf" class="b">.stop( true, false )</button>
  <button id="bcs" class="b">.clearQueue().stop()</button>
  <button id="bsff" class="b">.stop( false, false )</button>
  <button id="bs" class="b">.stop()</button>
  <button id="bsft" class="b">.stop( false, true )</button>
  <button id="bf" class="b">.finish()</button>
var horiz = $( "#path" ).width() - 20,
  vert = $( "#path" ).height() - 20;
var btns = {
  bstt: function() {
    $( "div.box" ).stop( true, true );
  bs: function() {
    $( "div.box" ).stop();
  bsft: function() {
    $( "div.box" ).stop( false, true );
  bf: function() {
    $( "div.box" ).finish();
  bcf: function() {
    $( "div.box" ).clearQueue().finish();
  bsff: function() {
    $( "div.box" ).stop( false, false );
  bstf: function() {
    $( "div.box" ).stop( true, false );
  bcs: function() {
    $( "div.box" ).clearQueue().stop();
$( "button.b" ).on( "click", function() {
  btns[ this.id ]();
$( "#go" ).on( "click", function() {
  $( ".box" )
      left: 10,
      top: 10
      top: vert
    }, 3000 )
      left: horiz
    }, 3000 )
      top: 10
    }, 3000 );


© The jQuery Foundation and other contributors
Licensed under the MIT License.