fadeTo method is used is jquery to set the opacity
of the element.
Syntax:
.fadeTo(
duration,opacity,callback)
Duration: This is used to determine that how
long the animation will be run.
Opacity:
We set it between 0 to 1, to achieve the target opacity.
Callback: This is a function which call only once to
animation complete.
Ex: In this example when we click on the
sentence, the color of the sentence will be fade.
<html>
<head>
<script
src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<span>
My Name is
Mahak Garg.
</span>
<script>
$("span").click(function
() {
$(this).fadeTo("slow",
0.50);
});
</script>
</body>
</html>
Output
After fadeTo() method: