jQuery slideUp()Methods

jQuery 效果方法jQuery Effect Methods

Examples

Hide all <p> elements with a sliding motion:

$("button").click(function(){
$("p").slideUp();
});

Try it Yourself »

Definition and Usage

The slideUp() method hides the selected elements with a sliding motion.

Note:Hidden elements will not be displayed at all (they no longer affect the page layout).

Tip:To display elements with a sliding motion, see theslideDown()method.

Syntax

$(selector).slideUp(speed,easing,callback)

Parameter Description
speed Optional. Specifies the speed of the sliding effect.

Possible values:

  • Milliseconds
  • "slow"
  • "fast"
easing Optional. Specifies the speed of the element at different points in the animation. Default value is "swing".

Possible values:

  • "swing" - moves slowly at the beginning/end, but fast in the middle
  • "linear" - moves at a constant speed
Tip:More easing functions are available in plug-ins.
callback Optional. A function to execute after the slideUp() method has finished.

To learn more about callback, please visit ourjQuery Callbackchapter.



实例

More Examples

slideUp() - Use the speed parameter
How to use the speed parameter to specify the speed of the sliding effect.

slideUp() - Use the callback parameter
How to use the callback parameter when sliding selected elements up and down.


jQuery 效果方法jQuery Effect Methods

Other Extensions