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

jQuery FadeIn

jQuery fadeIn() Method

The jQuery fadeIn() method is used to fade in a hidden element.

Syntax

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

  1. speed -It specifies the speed of the fadeIn 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 fadeIn() 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").fadeIn();
$("#box2").fadeIn("slow");
$("#box3").fadeIn(5000);
});
});
</script>
</head>
<body>
<button>Click to fade in boxes button</button><br><br>
<div id="box1" style="width:80px;height:80px;display:none;background-color:red;"></div><br>
<div id="box2" style="width:80px;height:80px;display:none;background-color:green;"></div><br>
<div id="box3" style="width:80px;height:80px;display:none;background-color:blue;"></div>
</body>
</html>

Output

jquery fadein method

When we click on the button fadein. It will show the fading boxes.

jquery fadein method
Prev Next