It a predefined method of jQuery. It is used to slide down an HTML element.
Syntax:
$(selector).slideDown(speed,callback);
Syntax:
The speed parameter is optional and used to specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.
The optional callback parameter is a function to be executed after the sliding completes.
Please see the below example to get better knowledge about slideDown().
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide down</title>
<style>
#panel{
height: 150px;
width: 150px;
background-color: blue;
border-radius: 50%;
display: inline-block;
}
#panel {
padding: 50px;
display: none;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<div id="panel"></div>
<br>
<button id="flip">Click to slide down</button>
<script>
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideDown("slow");
});
});
</script>
</body>
</html>
Syntax:
$(selector).slideDown(speed,callback);
The speed parameter is optional and used to specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.
The optional callback parameter is a function to be executed after the sliding completes.
Please see the below example to get better knowledge about slideUp().
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>slide up</title>
<style>
#panel{
height: 150px;
width: 150px;
background-color: blue;
border-radius: 50%;
display: inline-block;
}
#panel {
padding: 50px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<div id="panel"></div>
<br>
<button id="flip">Click to slide up</button>
<script>
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideUp("slow");
});
});
</script>
</body>
</html>