The .delay() instance method inserts a timed pause into jQuery’s effects queue. This tutorial covers the duration and queueName parameters since jQuery 1.4, why instant show/hide is not delayed, comparisons with setTimeout and .queue(fn), staggered reveal patterns, named custom queues, and five hands-on examples from the official jQuery API.
01
Queue pause
Wait between effects
02
Duration
ms, fast, slow
03
queueName
Custom queues
04
Chaining
slideUp → pause → fadeIn
05
Stagger
Index-based delays
06
clearQueue
Cancel pending pause
Fundamentals
Introduction
Chained jQuery effects run one after another on the default fx queue. Sometimes you need a visible gap between steps — a beat after a slide finishes before a fade begins, or a staggered entrance for list items. That is what .delay() is for.
Available since jQuery 1.4, .delay() enqueues a timer step rather than animating CSS. It returns the same jQuery object for chaining, and the next queued function runs only after the delay elapses and any prior queue items complete.
Concept
Understanding the .delay() Method
.delay( duration [, queueName ] ) accepts a duration in milliseconds or the strings "fast" and "slow". The optional queueName targets a named queue other than the default fx effects pipeline.
.delay() does not change element styles and does not delay instant operations. It only postpones the next item already sitting on the queue — typically another effect like .fadeIn() or a function added with .queue().
💡
Beginner Tip
Think of .delay() as a rest between dance moves in a choreographed chain. The slide finishes, everyone holds still for 800 ms, then the fade begins — all without writing setTimeout or splitting your logic across callbacks.
📋 .delay() vs setTimeout vs .queue(fn) vs .animate() duration
Four ways to introduce timing — only .delay() is a first-class fx queue pause between chained effects.
.delay()
.slideUp().delay(800).fadeIn()
Queue-native pause — waits after prior fx steps, then runs the next queued effect automatically
setTimeout
setTimeout(fn, 800)
Browser timer outside the fx pipeline — can overlap animations unless you manually synchronize
.queue(fn)
.queue(function(n) { ... n(); })
Custom queue step you must dequeue with next() — flexible but requires manual timing logic inside the function
.animate() duration
.animate({ left: 100 }, 800)
Active CSS tween over 800 ms — moves properties; unlike .delay(), something visible happens during the interval
Hands-On
Examples Gallery
Each example demonstrates an official jQuery API .delay() pattern. Open DevTools or use the Try-it links. All five mirror live demos on api.jquery.com/delay/.
📚 Getting Started
Official jQuery API demos — side-by-side delay vs no delay, and single-element chains.
Example 1 — Official Demo: div.first with Delay vs div.second Without (Official Example 1)
div.first slides up, pauses 800 ms, then fades in. div.second skips the pause and fades in immediately after slideUp.
div.first: slide up → 800ms hold → fade in (total gap visible)
div.second: slide up → fade in immediately (no pause between steps)
How It Works
Both divs enqueue slideUp(300) first. Only the first adds .delay(800) before fadeIn(400). The delay is itself a queue step — a timer that blocks the fx pipeline until 800 ms pass, then dequeues fadeIn.
Example 2 — Chained Pause on #foo (Official Example 2)
A single element runs the classic three-step chain: slide up, pause, fade in — the pattern most developers reach for first.
#foo collapses upward over 300ms, stays hidden for 800ms, then fades back over 400ms
How It Works
Method chaining keeps one readable pipeline. slideUp completes, then delay holds the queue, then fadeIn runs — no nested callbacks or external timers required.
📈 Advanced Patterns
Staggered timing, named queues, and cancellation with clearQueue.
Example 3 — Staggered Reveal with Index-Based .delay()
Three boxes each fade in sequentially by multiplying the loop index by 400 ms before enqueueing the effect.
jQuery
$( ".box" ).each( function( i ) {
$( this ).delay( i * 400 ).fadeIn( 400 );
});
Box 0 fades at 0ms, box 1 at 400ms, box 2 at 800ms — cascading entrance
How It Works
Each element gets its own fx queue. delay(i * 400) inserts a longer pause for higher indices before fadeIn starts, producing a stagger without separate setTimeout calls per box.
Example 4 — Named Custom Queue with .delay(500, "tasks")
Queue two custom functions on "tasks", insert a 500 ms delay on that same queue, then dequeue to run the pipeline.
jQuery
var $el = $( "#panel" );
$el
.queue( "tasks", function( next ) {
$( this ).text( "Step 1" );
next();
})
.delay( 500, "tasks" )
.queue( "tasks", function( next ) {
$( this ).text( "Step 2 — after 500ms pause" );
next();
});
$el.dequeue( "tasks" );
Text shows "Step 1" immediately, waits 500ms on "tasks" queue, then updates to Step 2
How It Works
By default .delay() targets fx. Passing "tasks" inserts the pause on a parallel queue you control with .queue() and .dequeue() — useful for non-animation workflows that still need serial timing.
Example 5 — clearQueue Cancels Pending .delay() Before fadeIn
Start a chain with a long delay, then call .clearQueue() to remove the pending pause so fadeIn never runs.
jQuery
var $box = $( "#box" );
$box.slideUp( 300 ).delay( 2000 ).fadeIn( 400 );
// User clicks Cancel before fadeIn would start
$( "#cancel" ).on( "click", function() {
$box.clearQueue();
});
Without cancel: slideUp → 2s pause → fadeIn
With clearQueue during pause: element stays hidden; fadeIn is dropped from fx queue
How It Works
.delay() is a queued timer step, not magic outside the pipeline. .clearQueue() wipes remaining fx items — including an in-progress delay and any effects after it — which is why cancel buttons in UI animations often call it.
Applications
🚀 Common Use Cases
Breathing room between effects — pause after .slideUp() before .fadeIn() so the user registers the transition.
Staggered list entrances — multiply index by a delay constant for cascading menu or card reveals.
Sequential messaging — chain text updates on a custom queue with .delay() between steps.
Tooltip or toast timing — show, delay, then hide within one fluent chain instead of nested timers.
Animation storyboards — combine .animate(), .delay(), and shorthand effects into readable timelines.
Cancellable sequences — pair long .delay() chains with .clearQueue() for skip or interrupt UX.
🧠 How .delay() Pauses the Queue
1
Prior fx step completes
Any effect before .delay() — such as slideUp(300) — must finish dequeuing first.
Setup
2
Delay enqueues a timer
jQuery inserts a timer step on fx (or the named queueName) for the requested duration.
Enqueue
3
Queue blocks
No further queued functions run until the timer fires — the element state stays unchanged during the pause.
Wait
4
▶
Timer dequeues next step
After duration elapses, the next queued item — fadeIn, animate, or a custom function — runs automatically.
Important
📝 Notes
Available since jQuery 1.4; signature .delay(duration [, queueName]).
"fast" = 200 ms, "slow" = 600 ms — same mapping as other effect methods.
Only delays subsequent queued items; instant .show(), .hide(), and .css() are unaffected.
Returns a jQuery object for method chaining on the same matched set.
.clearQueue() and .stop(true) remove pending delays along with waiting effects.
Set jQuery.fx.off = true globally and delay durations collapse to zero like other fx timings.
Compatibility
Browser Support
.delay() is a jQuery instance method since 1.4+. It uses jQuery’s internal fx timer and queue system — behavior is consistent wherever jQuery runs, independent of CSS animation support.
✓ Stable · jQuery 1.4+
jQuery .delay()
Supported in all jQuery 1.x, 2.x, 3.x, and 4.x releases. Works in Chrome, Firefox, Safari, Edge, IE 6+ (with compatible jQuery builds), and Node.js via jsdom.
100%jQuery delay API support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
.delay()Universal
Bottom line: Learn .delay() alongside .queue() and .clearQueue() to build readable, cancellable effect sequences in legacy and modern jQuery apps.
Wrap Up
Conclusion
The .delay() method is jQuery’s queue-native way to insert a timed pause between chained effects. It keeps animation timelines readable without scattering setTimeout calls through your code.
Use index-based delays for staggered reveals, named queues for non-fx workflows, and remember that .clearQueue() can cancel a pending delay before the next step fires. Pair this method with .animate() behind you and .queue() ahead to master the full fx pipeline.
Chain .delay() between effects for readable sequential timelines
Use index multiplication (i * 200) for staggered list or grid entrances
Pass queueName when delaying steps on a custom non-fx queue
Call .clearQueue() to let users skip or cancel long pending delays
Prefer .delay() over setTimeout when the next step is already queued
❌ Don’t
Expect .delay() to pause instant .show() or .css() — only queued steps wait
Replace visible motion with .delay() when you need an actual CSS tween — use .animate()
Mix unmanaged setTimeout callbacks with fx chains without coordinating dequeue
Forget that each matched element has its own queue when staggering collections
Stack very long delay chains without a cancel path — users may perceive the UI as frozen
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about .delay()
Queue-native pauses between chained jQuery effects.
5
Core concepts
⏱01
Queue pause
Not an animation
Core
📋02
duration
ms / fast / slow
API
🔄03
Chaining
slideUp → delay → fadeIn
Pattern
📈04
Stagger
Index Ã- delay
Advanced
❌05
clearQueue
Cancel pending wait
Hook
❓ Frequently Asked Questions
.delay() inserts a timed pause into jQuery's effects 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 (Number) or the strings "fast" (200 ms) or "slow" (600 ms). The optional queueName (String, default "fx") targets a named custom queue instead of the default effects pipeline.
No. .delay() only affects subsequent items already enqueued on a jQuery queue. Instant operations like .show(), .hide(), or .css() run immediately and are not delayed. Only the next queued effect or function waits after .delay() is called.
.delay() is queue-aware — it respects the fx pipeline and runs the next queued step only after prior effects finish plus the delay. setTimeout fires on the browser timer independently and can overlap with running animations unless you coordinate manually.
Yes. jQuery maps "fast" to 200 milliseconds and "slow" to 600 milliseconds, the same as .animate(), .fadeIn(), and other effect methods. Example: .delay("slow") pauses the queue for 600 ms before the next step.
Yes. .delay() enqueues a timer step on the queue. Calling .clearQueue() (or .stop(true)) removes pending queued items including an unfinished .delay(), so the next effect such as .fadeIn() will not run unless you trigger the chain again.
Did you know?
The official jQuery .delay() demo runs identical slideUp(300) chains on two divs — but only div.first inserts .delay(800) before fadeIn(400). That single chained call is often the clearest proof that .delay() is a queue step, not a CSS animation: the second div snaps to its fade while the first holds still for nearly a second.