jQuery .delay() Pause Between Queued Effects

Beginner
5 min read
Updated: Nov 2026
3 examples
Effects

Definition

.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.

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$("#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
CallWhat it does
.delay() Pause Between Queued EffectsLearn jQuery .delay(): pause the fx queue between chained effects since 1.4, duration and queueName, fast/slow strings, delay vs setTimeout, staggered reveals, named queues, and clearQueue cancellation.

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Select the element ($("#foo")).
Step 2Start a queued effect (.slideUp(300)).
Step 3Call .delay(800) (or "fast" / "slow").

Return Value

Return ValueDescription
jQuery objectMost setters and traversing helpers return the jQuery collection so you can chain more methods.
Value / undefinedGetters usually return a value from the first matched element, or undefined when nothing applies.

jQuery Examples

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).

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.

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.

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() Reveal Elements by Fading In

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

.fadeIn() Reveal Elements by Fading In tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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