Home >>jQuery Tutorial >jQuery slideUp() Method

jQuery slideUp() Method

jQuery slideUp() Method

jQuery jQuery slideUp() method is used to slides-up (hides) the selected elements.

Note: Hidden elements are no longer displayed (not affecting the page layout any more).

Syntax:
$(selector).slideUp(speed,easing,callback)

Parameter Values

Parameter Description
speed It is an optional parameter and is used to Specify the speed of the slide 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 slideUp() method is completed a function to be executed
Here is an example of jQuery slideUp() 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(){
$(".slideup").slideUp();
});
$(".btn2").click(function(){
$(".slideup").slideDown();
});
});
</script>
</head>
<body>
<p class="slideup">Hello Phptpoint</p>
<button class="btn1">Slide up</button>
<button class="btn2">Slide down</button>
</body>
</html>

Output:

Hello Phptpoint