Sample Code for writing fadeTo using jQuery
This article mainly introduces fadeTo written using jQuery. For more information, see
The Code is as follows:
<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 ('Alas, no ');
});
})
$ ('# Button2'). bind ('click', function (){
$ ('Img '). fadeIn (2000, function (){
$ ('# Button2'). val ('');
});
})
$ ('# Button3'). bind ('click', function (){
$ ('Img '). fadeTo (2000, 0.3, function (){
Alert ('animation execution completed ');
});
})
})
</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 = "specify transparency"/> </div>
<Div> </div>
</Div>
</Body>