Description:

Jquery slideToggle() method display/hide the matched elements with a sliding motion. Alternatively, weย can use slideToggle()ย method that perform both slide up and down animation ย based up on theย initialย display. If initial displays state is inย slide down then it will slide up the element or ย if the selected element is slide up then it will slide down.

Syntax

.slideToggle(

[duration ] [easing ] [callback/complete ] )

Ex :

Duration/speed ย It specifies the speed of the fadein. The valuse may be slow, fast and milliseconds. (default value: 400).ย Durationย are given in milliseconds and higher values indicate slower animations, not faster ones.
Easing ย It specifies the easing function to be used for transition (default value: swing).
Callback A function to call once the animation is complete.

Example:

From the below code, the selected (โ€œdivFadeBoxโ€) will be slideUp and slideDown based up on their initial display.ย For example, if the selected element is hidden state then slideToggle will performย the slideUp else it will perform the slideDown animation .

Output:

dotnethelpers-jquery-slidetoggle-thiyagu