Javascript Ajax jQuery Html PHP Example Quiz New MORE

jQuery slideup() Method With Example

It a predefined method of jQuery. It is used to slide up an HTML element.

Syntax:

$(selector).slideUp(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().

Example:

<!DOCTYPE html>  
<html lang="en">  
<head>  
  <meta charset="utf-8">  
  <title>slide toggle</title>  
	 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

<style> 
#panel{
  height: 150px;
  width: 150px;
  background-color: #66ff6b;;
  border-radius: 50%;
  display: inline-block;
}

#panel {
  padding: 50px;
}
</style>
<script> 
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideUp("slow");
});
});
</script>
</head>
<body>
<div id="panel"></div>
<br>
<button id="flip">Click to slide up</button>


</body>
</html>
Run it Yourself »