.slideUp() (since jQuery 1.0) hides matched elements with a sliding motion by animating height to 0. Lower content slides up as items collapse. When height reaches 0, display: none frees layout space. Returns the jQuery object for chaining.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
$("#panel").slideUp(); // default 400 ms
$("#panel").slideUp("slow"); // 600 ms
$("#panel").slideUp(600, "linear", function () { /* done */ });
// Visible → height shrinks → display: none
// Content below slides up as height decreases
Call
What it does
.slideUp()
Learn jQuery .slideUp(): hide matched elements with a sliding height animation since 1.0, duration presets, easing since 1.4.3, per-element callbacks, and compare with slideDown, hide, fadeOut, and slideToggle.
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Select a visible target ($("#panel")).
Step 2
On a user action, call .slideUp() (optional duration / easing / complete).
Step 3
jQuery animates height from natural size down to 0.
Return Value
Return Value
Description
Value / undefined
Getters usually return a value from the first matched element, or undefined when nothing applies.
jQuery Examples
Example 1 — Slow Collapse on Click
Official pattern: element starts shown; click slides it up over 600 ms.
jQuery
$("#clickme").on("click", function () {
$("#book").slideUp("slow", function () {
// Animation complete.
});
});
Click "Hide Two"
→ that <p> slides up over 600 ms
→ msg: "Hide Two has completed."
How It Works
Parent.$(this).parent() is the wrapping paragraph.
Slide. That p collapses with "slow".
Callback.this is the finished p (still in the DOM).
Frequently Asked Questions
.slideUp() hides matched elements with a sliding motion by animating height to zero. Lower page content slides up as items collapse. When height reaches 0 (or min-height), display is set to none so the element no longer affects layout.
1) .slideUp([duration] [, complete]) — optional duration and completion callback. 2) .slideUp(options) — an options object with duration, easing, queue, step, progress, and Promise-style callbacks. 3) .slideUp([duration] [, easing] [, complete]) — positional easing since jQuery 1.4.3.
.slideDown() reveals by animating height open. .hide() removes instantly with no transition. .fadeOut() animates opacity, not height. .slideToggle() picks slideDown or slideUp from current visibility. .slideUp() only collapses and hides.
Milliseconds, or the strings "fast" (200 ms) and "slow" (600 ms). Default is 400 ms when omitted.
Once per matched element when that element’s slide finishes — not once for the whole set. Use .promise().done() when you need a single callback after every element completes.
Yes. Start with a visible element that takes up layout space. Calling .slideUp() on already-hidden elements has little visible effect.