The jQuery.speed() static method builds a normalized PlainObject with duration, easing, complete, and queue for custom animations. This tutorial covers three overload signatures since jQuery 1.0 and 1.1, defaults of 400 ms and "swing", speed name normalization, plugin developer patterns, comparisons with raw .animate() options and manual defaults and jQuery.fx.off, and five hands-on examples from logging defaults to building a $.fn.pulse plugin.
01
PlainObject
Normalized animation props
02
Since 1.0
Stable plugin utility
03
Three overloads
Flexible signatures
04
Defaults
400 ms, swing easing
05
Speed names
slow, fast to numbers
06
Plugin devs
Custom animate methods
Fundamentals
Introduction
When you call .animate(), .fadeIn(), or .slideToggle(), jQuery internally normalizes the duration, easing, and callback arguments you pass. That normalization lives in jQuery.speed() — a static utility that returns a PlainObject ready for the effects engine.
Added in jQuery 1.0 (with additional overloads in 1.1), speed() is aimed at plugin developers who create new animation methods. Instead of reimplementing optional-parameter logic and default values, you call $.speed( options ) once and pass the result to .animate(). jQuery UI’s animated .addClass() follows this pattern. Defaults are duration 400 and easing "swing"; strings like "slow" map to 600 ms automatically.
Concept
Understanding the jQuery.speed() Method
Per the official jQuery API, jQuery.speed() creates an object containing properties ready for custom animation definitions. It is a static method on the global jQuery object — not something you invoke on a collection like $(selector).animate().
The returned object typically includes duration, easing, complete, and queue. jQuery fills in missing values with defaults and converts speed name strings to numeric milliseconds. Your plugin then spreads or passes those properties into .animate() without duplicating parameter hockey.
💡
Beginner Tip
Think of jQuery.speed() as a recipe formatter for animations. You hand it messy optional arguments — a number, a settings object, or duration plus easing plus callback — and it returns a clean object with duration: 400, easing: "swing", and the rest filled in consistently every time.
Foundation
📝 Syntax
Three overload signatures on the global jQuery object:
Static utility since 1.0. Normalizes three overload forms, speed names, and defaults (400 ms, swing). Returns a PlainObject for custom animation methods.
Hand-rolled fallbacks duplicate jQuery logic and miss speed name strings, queue handling, and edge cases speed() already covers.
jQuery.fx.off
jQuery.fx.off = true
Global Boolean that disables all tweens when true. Unrelated to parameter normalization — overrides duration at effect runtime regardless of speed object values.
Hands-On
Examples Gallery
Each example demonstrates a core jQuery.speed() concept from default values to plugin patterns. Open DevTools or use the Try-it links. Example 1 logs the default PlainObject returned by $.speed() with no arguments.
📚 Getting Started
Inspect the default PlainObject and build speed objects from settings or positional arguments.
With zero arguments, jQuery.speed() applies the same defaults effect methods use internally. This is the baseline every overload merges into before returning the PlainObject.
opt.duration: 800
opt.easing: linear
Box slides over 800 ms with linear easing
complete fires: "Animation complete!"
How It Works
The settings-only overload (since jQuery 1.1) is the most readable for plugin APIs that accept a single options argument. Unspecified properties keep their defaults.
📈 Advanced Patterns
Three-argument positional form, custom plugin methods, and speed name normalization.
Example 3 — Three-Arg Form: $.speed(600, "swing", complete) Then Use in .animate()
Match the signature of built-in effect methods: duration, easing string, and complete callback as separate arguments.
opt.duration: 600
opt.easing: swing
Fade runs 600 ms, then status: "Done at 600 ms"
How It Works
The three-argument overload mirrors how developers call .fadeIn( duration, easing, complete ). speed() converts that positional style into the same PlainObject shape as the settings form.
Example 4 — Plugin Pattern: $.fn.pulse Using $.speed(options) + .animate()
Build a reusable plugin method. Let $.speed() handle defaults and overload parsing, then chain two .animate() calls for a pulse effect.
$.fn.pulse registered
Click: targets fade to 0.35 then back to 1 over 400 ms each
opt.complete fires after second animate finishes
How It Works
This is the intended use case from the official docs. jQuery UI’s animated .addClass() delegates to speed() so plugin code stays DRY. Your plugin accepts the same flexible argument styles as native effect methods.
Example 5 — Speed Names: $.speed("slow") Normalizes to 600 ms
Pass a speed name string as the duration argument. $.speed( "slow" ) converts it to 600 milliseconds, matching .fadeIn( "slow" ) behavior.
slow: 600
fast: 200
UI label: "slow" → 600 ms
Box width animates over 600 ms
How It Works
Speed name resolution is shared with .animate(), .fadeIn(), and siblings. Plugin authors get correct numeric durations without maintaining their own string-to-ms lookup table.
Applications
🚀 Common Use Cases
Custom jQuery plugins — normalize duration, easing, and callbacks in $.fn.myEffect with one $.speed( options ) call.
jQuery UI-style extensions — mirror animated .addClass() by passing speed objects into internal .animate() chains.
Consistent defaults — rely on 400 ms and "swing" without hardcoding fallbacks in every method.
Speed name support — accept "slow" and "fast" in plugin APIs the same way built-in effects do.
Debugging animation options — log $.speed( userInput ) in DevTools to see what jQuery will actually use.
Queue control — set queue: false in the settings object when a plugin needs simultaneous tweens.
🧠 How jQuery.speed() Normalizes Animation Options
1
Arguments received
Plugin or internal code calls jQuery.speed() with zero to three arguments — a settings object, positional duration/easing/complete, or duration plus partial settings.
Input
2
Overload resolution
jQuery detects which signature matches. Speed name strings like "slow" convert to numeric milliseconds. Missing easing becomes "swing"; missing duration becomes 400.
Parse
3
PlainObject returned
The method returns { duration, easing, complete, queue } with all defaults filled. Plugin code passes these properties into .animate() or the fx engine directly.
Output
4
▶
Effect runs (unless fx.off)
.animate() uses the normalized values. If jQuery.fx.off is true, the global flag overrides duration at runtime and the tween completes instantly regardless of the speed object.
Important
📝 Notes
Added in jQuery 1.0 (duration, settings); extended in 1.1 with easing/complete and settings-only forms.
Returns a PlainObject — not a jQuery collection.
Default duration is 400 ms; default easing is "swing".
Speed names: "slow" → 600 ms, "fast" → 200 ms.
Intended for plugin developers creating new animation methods — built-in effects call it internally.
The returned object may include queue — set false for concurrent animations on the same element.
Separate from jQuery.fx.off, which globally disables tweens after options are normalized.
Compatibility
Browser Support
jQuery.speed() has been available since jQuery 1.0 (extended in 1.1) and remains supported in current jQuery 3.x releases. It is a JavaScript utility independent of browser animation APIs.
✓ Stable · Since jQuery 1.0
jQuery.speed()
Works in every browser that runs jQuery. Normalizes options in JavaScript before the fx engine runs. Pair with .queue() to inspect how normalized animations serialize on elements.
UniversalAll jQuery browsers
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
speed()Stable
Bottom line: Use speed() in plugins for consistent animation defaults. Learn .queue() next to see how normalized effects enter the fx pipeline.
Wrap Up
Conclusion
jQuery.speed() is a static utility that returns a normalized PlainObject with duration, easing, complete, and queue for custom animations. Three overload signatures accept settings objects or positional arguments; defaults are 400 ms and "swing".
Plugin developers should call $.speed( options ) instead of duplicating parameter parsing. Application code rarely needs it directly because .animate() invokes it internally. Continue to .queue() to inspect how normalized effects serialize on the fx pipeline.
Confuse speed() with fx.off — one normalizes options, one disables tweens globally
Call speed() on a jQuery collection — it is a static jQuery method
Assume app code always needs speed() — .animate() calls it for you
Forget that complete may be undefined when callers omit a callback
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about jQuery.speed()
Plugin utility for normalized animation options.
5
Core concepts
🌟01
PlainObject
Normalized props
Core
⏱02
Since 1.0
Plugin utility
API
🔄03
Three overloads
Flexible signatures
Syntax
📝04
400 / swing
Default values
Defaults
⚡05
Plugin devs
Custom methods
Pattern
❓ Frequently Asked Questions
<code>jQuery.speed()</code> returns a <code>PlainObject</code> containing normalized animation properties — typically <code>duration</code>, <code>easing</code>, <code>complete</code>, and <code>queue</code> — ready to pass into <code>.animate()</code> or a custom plugin method. It is a static utility on the global <code>jQuery</code> object, not a method on a jQuery collection.
The first overload <code>jQuery.speed( duration, settings )</code> was added in jQuery 1.0. The two-argument easing form and the settings-only form were added in jQuery 1.1. The method has remained a stable internal and plugin utility across jQuery 1.x, 2.x, and 3.x.
When you omit arguments or leave properties unset, <code>jQuery.speed()</code> applies <strong>duration <code>400</code></strong> (milliseconds) and <strong>easing <code>"swing"</code></strong>. Speed name strings like <code>"slow"</code> (600 ms) and <code>"fast"</code> (200 ms) are normalized to numeric durations automatically.
Plugin developers creating new animation methods should call <code>$.speed()</code> instead of duplicating parameter parsing. jQuery UI’s animated <code>.addClass()</code> uses this pattern. Application code can call it too, but most day-to-day animation uses <code>.animate()</code>, <code>.fadeIn()</code>, or similar methods that invoke <code>speed()</code> internally.
<code>jQuery.speed( duration, settings )</code> since 1.0; <code>jQuery.speed( duration, easing, complete )</code> since 1.1; and <code>jQuery.speed( settings )</code> since 1.1. All three return the same normalized PlainObject shape with defaults filled in.
<code>jQuery.speed()</code> normalizes duration and easing for a single animation call. <code>jQuery.fx.off</code> is a separate global flag that forces all jQuery effects to skip tweens when <code>true</code>. Even a perfectly normalized speed object is overridden at effect runtime when <code>fx.off</code> is enabled.
Did you know?
jQuery UI’s animated .addClass() delegates parameter parsing to jQuery.speed() so it accepts the same duration, easing, and callback styles as .animate() without reimplementing defaults. The method has existed since jQuery 1.0 — before many of today’s CSS transition APIs. See the official reference at api.jquery.com/jQuery.speed/.