Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

jQuery effect - swipe


May 07, 2021 jQuery


Table of contents


jQuery effect - Swipe


The jQuery sliding method allows elements to slide up and down.

Click here to hide/display the panel

An inch of light and an inch of gold, so we provide you with fast and easy to understand the content of learning.

Here you can get any knowledge you need in an easy-to-understand and convenient model.


jQuery slideDown()
Demonstrate the jQuery slideDown() method.

jQuery slideUp()
Demonstrate the jQuery slideUp() approach.

jQuery slideToggle()
Demonstrates the jQuery slideToggle() approach.


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 slide elements down.

Grammar:

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

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

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

The following example demonstrates the slideDown() approach:

$("#flip").click(function(){
$("#panel").slideDown();
});

Try it out . . .


jQuery slideUp() method

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

Grammar:

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

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

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

The following example demonstrates the slideUp() approach:

$("#flip").click(function(){
$("#panel").slideUp();
});

Try it out . . .


jQuery slideToggle() method

The jQuery slideToggle() method can be switched between the slideDown() and slideUp() methods.

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

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

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

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

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

The following example demonstrates the slideToggle() approach:

$("#flip").click(function(){
$("#panel").slideToggle();
});

Try it out . . .