Description
The .slideToggle() method toggles between slideUp() and slideDown() for the selected elements.
This method checks each element for visibility. slideDown() is run if an element is hidden. slideUp() is run if an element is visible - This creates a toggle effect.
v1.0
This method has the form:
.slideToggle(duration,callback)
Parameter | Description |
---|---|
duration | (optional) Specifies the speed of the slide effect (default = "normal").
Possible values:
|
callback | (optional) A function to be executed after the slideToggle() method is completed. |
Return Value
This form returns a jQuery object.
v1.4.3
This method has the alternate form:
.slideToggle(speed,easing,callback)
Parameter | Description |
---|---|
speed | (optional) Specifies the speed of the slide effect (default = "normal").
Possible values:
|
easing | (optional) A string indicating which easing function to use for the transition. |
callback | (optional) A function to be executed after the slideToggle() method is completed. |
Return Value
This form returns a jQuery object.
Examples
Toggle between slide up and slide down for a p element:
$("button").click(function(){
$("p").slideToggle();
});