.animate() (since jQuery 1.0) performs a custom animation of numeric CSS properties on matched elements. You pass a map of targets; jQuery tweens from the current values to those targets. Returns the jQuery object for chaining.
Remember
$("#box").animate({ width: "70%", opacity: 0.4 }, 1500);
$("#box").animate({ left: "+=50px" }, "slow");
$("#box").animate({ height: "toggle" }, { duration: 400, easing: "linear" });
// Numeric props only · does not auto-show hidden elements
// Queued by default · queue:false runs in parallel
Use += / -= for relative moves; "show" / "hide" / "toggle" for height, width, opacity, and similar.
Chain more .animate() calls to queue steps, or set queue: false for parallel runs.
Piece
Required?
Role
properties
Yes
Map of CSS targets (camelCase or quoted)
duration
No
Default 400; also "fast" (200) / "slow" (600)
easing
No
Default "swing"; built-in also "linear"
complete
No
Runs once per matched element when its animation ends
Return value
—
jQuery object (chainable)
Pseudocode
Pseudocode
call $(elements).animate(properties, duration?, easing?, complete?)
// or .animate(properties, options)
for each matched element:
resolve relative values (+= / -=) from current CSS
resolve show / hide / toggle keywords
enqueue on fx (unless queue: false)
each frame:
tween every property toward its target
if step provided: call step(now, fx)
when finished:
if complete provided: call complete (this = DOM element)
return the jQuery set for chaining
Reference
Cheat Sheet
Keep these facts handy while building custom animations.
Keyword."toggle" chooses show or hide from current visibility.
Pair. Height and opacity animate together in one call.
Slow."slow" is 600 ms.
Note. For simple fade toggles, prefer .fadeToggle().
Watch outs
Edge Cases & Pitfalls
Case
What happens
Fix
Element is display: none
Animation may not be visible
Call .show() first, or use fade/slide helpers
Animate left / top
No movement if position is static
Set position: relative or absolute
Color / shorthand CSS
Ignored or incomplete without plugins
Numeric longhands; Color plugin for colors
Spam clicks
Long fx queue builds up
.stop(true, true) before .animate()
jQuery.fx.off
Duration becomes 0
Respect reduced-motion / accessibility settings
Compatibility
Browser Support
.animate() has been part of jQuery since 1.0. It works in every browser that runs your loaded jQuery version — no separate CSS animation feature flag.
✓ Stable · jQuery 1.0+
jQuery .animate()
Supported across jQuery 1.x, 2.x, and 3.x. Prefer a current jQuery 3.x build. Directional properties still need non-static positioning.
100%With jQuery
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
.animate()Universal
Bottom line: Safe for everyday custom tweens. Stick to numeric properties, stop before spam clicks, and use fade/slide helpers when you only need show/hide.
Analysis
Performance Notes
Approach
Cost
Best for
Few properties, one element
Cheap
UI polish, panels, buttons
Many elements × many props
More layout/paint
Animate a container, not every child
Queued spam clicks
Wasted frames
Always .stop(true, true) on busy controls
CSS transitions / requestAnimationFrame
Often smoother
Heavy motion, complex timelines
Small .animate() calls are fine for learning and simple UI. Prefer fewer properties, smaller sets, and stop-before-animate on interactive controls.
Remember
Key Takeaways
Role: custom numeric CSS tweens — since jQuery 1.0.
Call:$el.animate({ prop: value }, duration) — default 400 ms.
Limits: no auto-show; colors need a plugin; stop spam with .stop().
One line:.animate() tweens numeric CSS properties you choose — the flexible alternative to fade/slide helpers.
Frequently Asked Questions
.animate() runs a custom animation on matched elements by gradually changing numeric CSS properties toward target values. Unlike .fadeIn() or .slideUp(), it does not automatically show hidden elements — you choose exactly which properties move and for how long.
1) .animate(properties [, duration] [, easing] [, complete]) — positional duration, easing, and complete callback. 2) .animate(properties, options) — an options object with duration, easing, queue, specialEasing, step, progress, complete, start, done, fail, and always.
Basic jQuery animates numeric properties such as width, height, left, opacity, and scrollTop. Colors need the jQuery Color plugin or jQuery UI. Prefer longhand names like fontSize or borderWidth over shorthand font or border.
By default queue is true, so each .animate() waits on the fx effects queue. queue: false starts that animation immediately without waiting for prior queued effects. Later chained .animate() calls still enqueue unless they also set queue: false.
step fires on each animation frame for every animated property on every element. It receives now (current numeric value) and fx (tween object with elem, prop, start, end). Use it to sync other elements or build custom mid-flight behavior.
When a property value starts with += or -=, jQuery computes the target from the current value. { left: "+=50px" } moves 50px right; { left: "-=50px" } moves 50px left. Chained relative moves queue naturally — each step runs after the previous one finishes.