Easy Tutorial
❮ Sel Input Selected Misc Deferred Isresolved ❯

jQuery slideToggle() Method

jQuery Effects Methods

Example

Toggle between slideUp() and slideDown() on all <p> elements:


Definition and Usage

The slideToggle() method toggles between slideUp() and slideDown() on the selected elements.

This method checks the visibility of the selected elements. If an element is hidden, it runs slideDown(); if an element is visible, it runs slideUp() - creating a toggle effect.

Syntax

Parameter Description
speed Optional. Specifies the speed of the slide effect. Possible values: milliseconds<br> "slow"<br> "fast"
easing Optional. Specifies the speed of the element at different points of the animation. Default value is "swing". Possible values: "swing" - moves slower at the start/end, faster in the middle<br> "linear" - moves at a constant speed. Note: More easing functions are available in extensions.
callback Optional. A function to be executed after the slideToggle() method completes. To learn more about callback, visit our jQuery Callback chapter.

More Examples

slideToggle() - Using speed parameter

slideToggle() - Using callback parameter


jQuery Effects Methods

❮ Sel Input Selected Misc Deferred Isresolved ❯