Skip to main content
Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.

$.stop() vs. $.finish() In jQuery Animations

By Ben Nadel on

The other day, I was reviewing some code when I came across a relatively new jQuery function - $.finish(). This function was added in jQuery 1.9 and works similarly to the old $.stop() method with one very important difference: when you call $.finish(), jQuery applies the same CSS to the given set of elements that would have been applied if all of the animations had been allowed to finish naturally.

View this demo in my JavaScript-Demos project on GitHub.

When you call $.stop() with the two optional arguments (true, true), jQuery will:

  1. Clear the animations queue for the element.
  2. Jump to the end of the currently-executing animation.

The different between $.stop() and $.finish() lies in the second item above. When $.stop() is called, jQuery will only jump to the end of the currently-executing animation; any subsequent animations in the queue will be cleared and ignored. If you call $.finish(), on the other hand, jQuery will jump to the end of all of the queued animations - not just the currently executing animation.

If you only have one animation in the "fx" queue, the following two statements are functionally equivalent:

  • $.stop( true, true )
  • $.finish()

Since this is probably how most people interact with the $.stop() method, the difference may be hard to understand at first. It really only becomes apparent when more than one animation is being applied to the current element. To see this in action, I have two boxes below, each of which has two animations: slide-out and slide-in. If you "halt" the demo during the first animation, the difference will become clear:

<!doctype html>
	<meta charset="utf-8" />

		Stop() vs. Finish() In jQuery

	<style type="text/css"> {
			background-color: #FAFAFA ;
			border: 1px solid #CCCCCC ;
			height: 50px ;
			line-height: 50px ;
			overflow: hidden ;
			width: 0px ;

		form {
			margin-bottom: 16px ;


		Stop() vs. Finish() In jQuery

	<form action="#">
		<input type="button" value="Reset" class="reset" />
		<input type="button" value="Start" class="start" />
		<input type="button" value="Halt" class="halt" />

	<div class="box box1">

	<br />

	<div class="box box2">

	<!-- Load scripts. -->
	<script type="text/javascript" src="../../vendor/jquery/jquery-2.0.3.min.js"></script>
	<script type="text/javascript">

		// Cache our DOM elements like good citizens.
		var dom = {
			reset: $( "input.reset" ),
			start: $( "input.start" ),
			halt: $( "input.halt" ),
			box1: $( "div.box1" ),
			box2: $( "div.box2" )

		// Reset the demo by quitting all animations and manually
		// setting the widths.
			function( event ) {

				dom.box1.add( dom.box2 )
					.stop( true, true )
					.width( 0 )


		// Start animations on both elements. The animations will
		// include a slide-out followed by a slide-in of each element.
		// Meaning, there are two different animations in the queue at
		// the start of the experiment.
			function( event ) {

				dom.box1.add( dom.box2 )
					.animate( { width: "400px" }, 3000 )
					.animate( { width: "0px" }, 2000 )


		// Stop both animations.
			function( event ) {

				// True ( clear queue, jump to end ).
				dom.box1.stop( true, true );





Anyway, that is just a quick post. I haven't written much about jQuery, directly, in a long time. So, coming across an unknown function was pretty exciting. #NerdLife

Reader Comments

jQuery stop() method stops the currently running animation on the matched elements but jQuery finish() stops the currently running animation, removes all the queued animations and complete all the animations for the matched elements.

When you call $.stop() with the two optional arguments i.e. (true, true), then jQuery:

Clear the animations queue for that element
Jumps to end of the currently executing animation
So, actual different between $.stop() and $.finish() lies in the second item above.