Home >>jQuery Tutorial >jQuery fadeOut() Method
jQuery fadeOut() method in jQuery is used to change the level of opacity (fade out the element) for selected element from visible to hidden.
Syntax:$(selector).fadeOut(speed,easing,callback)
Parameter | Description |
---|---|
speed | It is an optional parameter and is used to Specify the speed of the fading effect. Its default value is 400 milliseconds
Possible values:
|
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:
|
callback | It is an optional parameter. After the fadeOut() method is completed a function to be executed |
<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(){
$("h1").fadeOut();
});
$(".btn2").click(function(){
$("h1").fadeIn();
});
});
</script>
</head>
<body>
<h1>PHPTPOINT</h1>
<button class="btn1">Fade out</button>
<button class="btn2">Fade in</button>
</body>
</html>
<html>
<head>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
</head>
<body style = "text-align:center;">
<h1 style = "color:orange;" >
PHPTPOINT
</h1>
<h2>jQuery fadeOut() Method</h2>
<button class="btn4">Fade out</button>
<button class="btn5">Fade in</button>
<script>
$(document).ready(function(){
$(".btn4").click(function(){
$("h2").fadeOut(1000);
});
$(".btn5").click(function(){
$("h2").fadeIn(1000);
});
});
</script>
</body>
</html>