This Angular tutorial helps you get started with Angular quickly and effectively through many practical examples.

jQuery FadeOut

jQuery fadeOut() Method

The jQuery fadeOut() method is used to fade out a visible element.

Syntax

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

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

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

The following example demonstrates the fadeOut() method with different parameters:

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(){
$("button").click(function(){
$("#box1").fadeOut();
$("#box2").fadeOut("slow");
$("#box3").fadeOut(1000);
});
});
</script>
</head>
<body>

<button>Click to fade out boxes button</button><br><br>

<div id="box1" style="width:80px;height:80px;background-color:red;"></div><br>
<div id="box2" style="width:80px;height:80px;background-color:green;"></div><br>
<div id="box3" style="width:80px;height:80px;background-color:blue;"></div>
</body>
</html>

Output

jquery fadeout method

When we click on the button fadeout. It fade out a visible element.

jquery fadeout method
Prev Next