Call function after fadeTo effect - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:animate

Description

Call function after fadeTo effect

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
        $("button").click(function(){
            $("p").fadeTo(2000, 0.2, function(){
                console.log("The fadeTo effect is finished!");
            });/*from w  ww .j ava 2 s.c o  m*/
        });
});
</script>
</head>
<body>

<button>Gradually change the opacity of the p element</button>

<p>This is a paragraph.</p>

</body>
</html>

Related Tutorials