Home/Jquery/.slideToggle() Effect in Jquery

.slideToggle() Effect in Jquery


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.



[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).
CallbackA function to call once the animation is complete.


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 .



Leave a Reply