How to use Effect FadeTo() Method in JQuery

In this article I am going to explain about Effect FadeTo() method in jquery.
  • 1871

jQuery Effect FadeTo() Method

jquery FadeTo() is also use for change the opacity of selected element. But in FadeTo() method we can set manually opacity presented of selected element.

Syntax

$(selector).fadeIut(speed,opacity)

Example

<head>

    <script type="text/javascript" src="jquery.js"></script>

    <script type="text/javascript">

        $(document).ready(function () {

            $("button").click(function () {

                $("div").fadeTo(1000, 0.5);

            });

        });

    </script>

</head>

<body>

    <div style="background-color: Blue; height: 100px; width: 100px;">

    </div>

    <button>

        click me</button>

</body>

</html>

 

Output

 

 fadeto.jpg

 

You may also want to read these related articles: here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 
© 2020 DotNetHeaven. All rights reserved.