</>
Skip to content
jQuery lessons (12/39)

jQuery — Stop

stop()

$("div").stop();  // Stop current animation

stop(true)

$("div").stop(true);  // Stop and clear queue

stop(true, true)

$("div").stop(true, true);  // Stop, clear queue, jump to end

Practical: Hover Animations

$(".hover-box").hover(
    function() {
        $(this).stop().animate({ width: "200px" }, 300);
    },
    function() {
        $(this).stop().animate({ width: "100px" }, 300);
    }
);

finish()

$("div").finish();  // Stop and jump to end of ALL queued animations

Animation Queue Behavior

Without stop(), animations queue up:

// BAD: Multiple clicks cause stacking
$("div").click(function() {
    $(this).animate({ left: "+=100px" }, 500);
});

// GOOD: stop() clears the queue
$("div").click(function() {
    $(this).stop().animate({ left: "+=100px" }, 500);
});

stop() Parameters

ParameterDefaultDescription
clearQueuefalseClear remaining animations
jumpToEndfalseJump to current animation end

Mini Practice

  1. Stop a hover animation on mouse leave
  2. Use stop(true) to clear the queue
  3. Use finish() to jump to end
  4. Test animation stacking without stop()

Up Next

Continue with Callback — executing code after animations complete.

Related Topics

Frequently Asked Questions about Stop

What is Stop in jQuery?

Stop is a fundamental concept in jQuery. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Stop?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Stop.

Why is Stop important in jQuery?

Stop is essential for jQuery development. Understanding this concept will help you write better code and solve real-world problems more effectively.