0
FadeIn effect in JQuery expain with eample?
FadeIn effect in JQuery expain with eample?
Syntax:
$(selector).fadeIn();
$(selector).fadeIn(speed,callback);
Speed and callback is an optional parameter. Speed specifies the delay of showing elements these possible vales are 'slow', 'fast' and milliseconds. Callback function to be called after completion of fadeIn().
<!DOCTYPE html>
<html>
<head>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
<script>
$(document).ready(function () {
$('button').click(function () {
$('#div1').fadeIn();
$('#div2').fadeIn('slow');
$('#div3').fadeIn(3000);
});
});
</script>
<style>
div {
width: 100px;
height: 100px;
display: none;
border-radius:25px;
text-align:center;
color:white;
}
</style>
</head>
<body>
<button>Click to fade in boxes</button><br>
<br>
<div id='div1' style='background-color:black;'>
black
</div>
<br>
<div id='div2' style='background-color:blue;'>
blue
</div>
<br>
<div id='div3' style='background-color:red;'>
red
</div>
</body>
</html>
