jQuery .delay() Pause Between Queued Effects

Beginner
7 min read
Updated: Oct 2026
5 examples
Live preview

What Is .delay()?

.delay() (since jQuery 1.4) sets a timer that pauses subsequent items on a queue (default "fx"). It does not animate by itself — it waits, then the next queued step runs. Returns the jQuery object for chaining.

Remember
$("#foo").slideUp(300).delay(800).fadeIn(400);
$el.delay("slow");                 // 600 ms
$el.delay(500, "tasks");           // named queue

// Only queued steps wait · not instant show/hide/css
NeedUse
Pause between chained effects$el.delay(800)
General timer / cancel freelysetTimeout / clearTimeout
Cancel pending delay.clearQueue()
Custom numeric tween.animate()
Halt current effect.stop()

How to Use .delay()

Chain .delay() between two queued effects so the second waits after the first finishes.

  1. Select the element ($("#foo")).
  2. Start a queued effect (.slideUp(300)).
  3. Call .delay(800) (or "fast" / "slow").
  4. Chain the next queued effect (.fadeIn(400)).
  5. To cancel before it fires, call .clearQueue() (and .stop() if needed).
PieceRequired?Role
durationYesMilliseconds, or "fast" (200) / "slow" (600)
queueNameNoDefaults to "fx"; pass a custom name when needed
Return value—jQuery object (chainable)

Pseudocode

Pseudocode
call $(elements).delay(duration, queueName?)

name = queueName or "fx"
ms = resolve duration ("fast"→200, "slow"→600, or number)

for each matched element:
    enqueue a timer step on queue "name"
    when prior queued work is done:
        wait ms milliseconds
        then run the next queued function

return the jQuery set for chaining

Cheat Sheet

Keep these facts handy while timing effect chains.

TopicDetail
Syntax.delay( duration [, queueName ] )
SincejQuery 1.4
Default queue"fx"
Presets"fast" = 200 · "slow" = 600
Classic chain.slideUp(300).delay(800).fadeIn(400)
Does not delayInstant .show() / .hide() / .css()
Cancel pending$el.clearQueue()
Named queue$el.delay(500, "tasks")
vs setTimeoutQueue-aware pause · limited cancel API

Live Preview

Run a slideUp → delay → fadeIn chain. Pick the pause length, then reset.

Watch the pause between slide up and fade in.

The box slides up, waits, then fades back in. Reset restores a visible starting state.

Result
Ready — click Run to delay between effects.

jQuery Examples

Short, copy-ready snippets. Open DevTools, or use Try It Yourself for a live editor.

Example 1 — Official Two-Div Demo

From the jQuery docs: first div delays 800 ms; second fades in immediately after slideUp.

jQuery
$("button").on("click", function () {
  $("div.first").slideUp(300).delay(800).fadeIn(400);
  $("div.second").slideUp(300).fadeIn(400);
});
Try It Yourself

How It Works

  1. Shared start. Both call .slideUp(300).
  2. Pause. Only .first inserts .delay(800).
  3. Resume. After 800 ms, green runs .fadeIn(400).
  4. Contrast. Blue has no delay, so its fadeIn starts sooner.

Example 2 — Classic #foo Chain

The docs’ one-liner: slide up, wait 800 ms, fade in.

jQuery
$("#run").on("click", function () {
  $("#foo").show().slideUp(300).delay(800).fadeIn(400);
});
Try It Yourself

How It Works

  1. show. Instant .show() ensures a visible start (not delayed).
  2. slideUp. Queued effect runs for 300 ms.
  3. delay. Enqueues an 800 ms wait on fx.
  4. fadeIn. Runs only after the wait finishes.

Example 3 — Staggered Reveal

Increase delay by index so each box fades in after the previous one.

jQuery
$("#run").on("click", function () {
  $(".box").hide();
  $(".box").each(function (i) {
    $(this).delay(i * 400).fadeIn(500);
  });
});
Try It Yourself

How It Works

  1. Reset. .hide() starts all boxes hidden.
  2. Index. i * 400 spaces each delay apart.
  3. Per element. Each box has its own fx queue.
  4. Reveal. Boxes appear one after another.

Example 4 — Named Custom Queue

Pause on a non-fx queue between custom .queue() steps.

jQuery
$("#run").on("click", function () {
  var $el = $("#worker");
  $el.clearQueue("tasks");
  $("#log").text("");

  $el.queue("tasks", function (next) {
    $("#log").append("Step A\n");
    next();
  });
  $el.delay(500, "tasks");
  $el.queue("tasks", function (next) {
    $("#log").append("Step B (after 500ms delay)\n");
    next();
  });
  $el.dequeue("tasks");
});
Try It Yourself

How It Works

  1. Name. Work lives on "tasks", not fx.
  2. delay. .delay(500, "tasks") pauses that queue only.
  3. dequeue. Starts the custom pipeline running.
  4. Order. Step B prints after the 500 ms wait.

Example 5 — Cancel a Pending Delay

Use .clearQueue() during a long pause so the later fadeIn never runs.

jQuery
$("#start").on("click", function () {
  $("#box").stop(true, true).show()
    .slideUp(300)
    .delay(2000)
    .fadeIn(400);
});

$("#stop").on("click", function () {
  $("#box").clearQueue().stop();
});
Try It Yourself

How It Works

  1. Start. Chains slideUp, a 2s delay, then fadeIn.
  2. Waiting. During the delay, fadeIn is still pending on fx.
  3. clearQueue. Removes the delay timer and fadeIn.
  4. stop. Halts any effect currently playing.

Edge Cases & Pitfalls

CaseWhat happensFix
Delay before instant .show()show runs immediatelyUse a queued effect, or setTimeout
Need cancel mid-wait.delay() has no dedicated cancel API.clearQueue(), or use clearTimeout
Wrong queue namePause never applies to your stepsMatch the name used in .queue("name", …)
Spam-click chainsMany delays stack on fx.clearQueue().stop() before starting again
Long delays for UXFeels sluggishKeep pauses short; prefer subtle timing

Browser Support

.delay() has been part of jQuery since 1.4. It works in every browser that runs your loaded jQuery version — no separate timer feature flag.

✓ Stable · jQuery 1.4+

jQuery .delay()

Supported across jQuery 1.x (1.4+), 2.x, and 3.x. Prefer a current jQuery 3.x build. Use it for fx pauses; use setTimeout for general timers.

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

Bottom line: Safe between queued effects. Remember it does not delay instant methods, and clearQueue can cancel a pending pause.

Performance Notes

ApproachCostBest for
One .delay() in a chainCheapShort pauses between effects
Many stacked delaysWasted waitingClear the queue on busy buttons
Staggered list (i * n)Fine for small setsKeep item counts modest

A single delay is inexpensive. Cost comes from stacking long chains on rapid clicks — clear pending work before restarting, and keep pauses short for better UX.

Key Takeaways

  • Role: pause subsequent queued steps — since jQuery 1.4.
  • Call: $el.slideUp().delay(800).fadeIn() — ms or fast/slow.
  • Scope: queue only — not instant show/hide/css.
  • Cancel: .clearQueue() · prefer setTimeout for general timers.

One line: .delay() inserts a timed pause between queued effects — not a general-purpose timer.

Frequently Asked Questions

.delay() inserts a timed pause into a jQuery queue on matched elements. It does not animate anything itself — it waits for the specified duration, then lets the next queued function run. Use it between chained effects like .slideUp().delay(800).fadeIn().
.delay(duration [, queueName]) takes duration as milliseconds or the strings "fast" (200 ms) and "slow" (600 ms). The optional queueName (default "fx") targets a named custom queue instead of the standard effects queue.
No. .delay() only affects subsequent items already enqueued on a jQuery queue. Instant no-argument .show() / .hide() and .css() run immediately and are not delayed.
.delay() is queue-aware — the next queued step runs after prior effects finish plus the delay. setTimeout fires on the browser timer independently and can overlap animations unless you coordinate manually. Prefer setTimeout when you need flexible cancel or non-queue logic.
Yes. jQuery maps "fast" to 200 ms and "slow" to 600 ms, the same as .animate() and .fadeIn(). Example: .delay("slow") pauses the queue for 600 ms.
Yes. .delay() enqueues a timer step. Calling .clearQueue() (or .stop(true)) removes pending queued items, including an unfinished delay, so the next effect will not run unless you start the chain again.

Next: .fadeIn() Method

Reveal hidden content by animating opacity — a common step after .delay().

.fadeIn() tutorial →

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.

10 people found this page helpful