jQuery SlideDown

jQuery slideDown() Method

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

Syntax

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

  1. speed -It specifies the speed of the slideDown effect. Default value is 400 milliseconds. Possible values:

    • milliseconds
    • slow
    • fast
  2. callback - A function to be executed after the slideDown method is completed.

 The following example demonstrates the slideDown() method.

Example

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script> 
$(document).ready(function(){
$("#flipid").click(function(){
$("#panelid").slideDown("slow");
});
});
</script>
<style> 
#flipid {
padding: 5px;
text-align: center;
background-color: red;
border: solid 1px green;
}

#panelid {
padding: 5px;
text-align: center;
background-color: green;
border: solid 1px green;
color:white;
}

#panelid {
padding: 50px;
display: none;
}
</style>
</head>
<body>

<div id="flipid">Click to slide down</div>
<div id="panelid">Tutorialstrend.com!</div>

</body>
</html>

Output

jquery slideDown method

Now click on the Click to slide down. It will slide down as following:

jquery slideDown method
Prev Next