jQuery Sliding Effect

tutorial and example
tutorial and example

jQuery slide is used to slides the element out of the viewport.

Here are some slide methods:

  • slideDown()
  • slideUp()
  • slideToggle()

jQuery slideDown()

slideDown() method of jQuery is used to slide down an element.

Syntax:

  1. $(selector).slideDown(speed, callback);

speed: Speed is an optional parameter. It is used to specify delay. Its value can be fast or slow and it is defined in milliseconds.

callback: Callback is an optional parameter. It represents a function to be executed after the completion of the slideDown() method.

Example:

Try Now

jQuery slideUp()

jQuery slideUp() method is used to slide up an element.

Syntax:

speed: Speed is an optional parameter. It is used to specify delay. Its value can be fast or slow and it is defined in milliseconds.

callback: Callback is an optional parameter. It represents a function to be executed after the completion of the slideUp() method.

Example:

Try Now

jQuery slideToggle() Method

The jQuery slidetoggle() method is used to make toggle between the slideUp() and slideDown() method. If the element is slide down, slideToggle() will slide them up and if they are slide up, slideToggle() will slide them down.

Syntax:

speed: Speed is an optional parameter. It is used to specify delay. Its value can be fast or slow and it is defined in milliseconds.

callback: Callback is an optional parameter. It represents a function to be executed after the completion of the slideToggle() method.

Example:

Try Now