Home >>jQuery Tutorial >jQuery slideDown() Method

jQuery slideDown() Method

jQuery slideDown() Method

jQuery slideDown() method slides-down (shows) the elements selected.

Note: slideDown() works with jQuery methods on elements hidden and display: none in CSS (but not visibility: hidden).

Syntax:
 slides-down (shows) the elements selected. 

Parameter Values

Parameter Description
speed It is an optional parameter and is used to Specify the speed of the slide down effect. Its default value is 400 milliseconds

Possible values:

  • milliseconds
  • "slow"
  • "fast"
easing It is an optional parameter and is Specify the speed of the element in points of the animation. Its Default value is "swing"

Possible values:

  • "swing" - faster in the middle, moves slower at the beginning
  • "linear" – it moves in a constant speed
callback It is an optional parameter. After the slideDown() method is completed a function to be executed
Here is an Example of jQuery slideDown() Method:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".btn1").click(function(){
$(".slideDown").slideUp();
});
$(".btn2").click(function(){
$(".slideDown").slideDown();
});
});
</script>
</head>
<body>
<p class="slideDown">PHPTPOINT</p>
<button class="btn1">Slide up</button>
<button class="btn2">Slide down</button>
</body>
</html>

Output:

PHPTPOINT


No Sidebar ads