JQuery writes the fadeTo sample code

  • 2020-03-30 02:03:50
  • OfStack

 
<title></title> 
<style type="text/css"> 
.imgclass{ width:300px; height:300px; border:solid 1px red;} 
</style> 
<script src="jquery-1.9.1.js" type="text/javascript"></script> 
<script type="text/javascript"> 
$(function () { 
$('#Button1').bind('click', function () { 
$('img').fadeOut(2000, function () { 
$('#Button1').val(' Oh, no '); 
}); 
}) 
$('#Button2').bind('click', function () { 
$('img').fadeIn(2000, function () { 
$('#Button2').val(' There are the '); 
}); 
}) 
$('#Button3').bind('click', function () { 
$('img').fadeTo(2000, 0.3, function () { 
alert(' Animation finished '); 
}); 
}) 
}) 
</script> 
</head> 
<body> 
<div> 
<div> 
<input id="Button1" type="button" value=" Fade out " /><input id="Button2" type="button" value=" Fade in " /><input id="Button3" type="button" value=" Specified transparency " /></div> 
<div><img src="images/1.jpg" class="imgclass"/></div> 
</div> 
</body> 

Related articles: