FadeIn effect in JQuery expain with eample?

0 votes
48 views
Ethan Karla asked 27-Jul-2021 in Web Application by Ethan Karla

FadeIn effect in JQuery expain with eample?

1 Answer

1 votes
Ravi Vishwakarma answered 29-Jul-2021 by Ravi Vishwakarma
JQuery fadeIn()
 The jQuery fadeIn() method is used to fade in an element. If an object is to be made lighter, then do it.
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>
FadeIn effect in JQuery expain with eample?