jQuery slide

The jQuery slide method causes the element to slide up and down.

jQuery sliding method


With jQuery, you can create a sliding effect on an element.

jQuery has the following sliding methods:

slideDown()

slideUp()

slideToggle()

jQuery slideDown() method


The jQuery slideDown() method is used to swipe an element down.

grammar:

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

The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast" or milliseconds.

The optional callback parameter is the name of the function that is executed after the swipe is complete.

The following example demonstrates the slideDown() method:
 
Run and try it out

jQuery slideUp() method


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

grammar:

$(selector).slideUp(speed,callback);

The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast" or milliseconds.

The optional callback parameter is the name of the function that is executed after the swipe is complete.

The following example demonstrates the slideUp() method: 

Run and try it out

jQuery slideToggle() method


The jQuery slideToggle() method toggles between the slideDown() and slideUp() methods.

If the element slides down, slideToggle() can slide them up.

If the element slides up, slideToggle() can slide them down.

Grammar

$(selector).slideToggle(speed,callback);

The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast" or milliseconds.

The optional callback parameter is the name of the function that is executed after the swipe is complete.

The following example demonstrates the slideToggle() method:

 
Run and try it out

Last Updated: 2018-11-24 14:25:23 By Akshay

SHARE THIS

share_facebook share_twitter share_google_plus

Please Comment Here :