fade
英[feɪd] 美[fed]
vi. fade, lose luster; gradually disappear; wither, age
vt .to fade
adj. boring, plain
to
English[tə] US[tu,tə]
prep.To; toward, toward; about; belonging to
adv.Towards one direction; to a certain state; to close
jquery fadeTo() method syntax
Function: fadeTo() method gradually changes the opacity of the selected element to the specified value.
Syntax: $(selector).fadeTo(speed,opacity,callback)
Parameters:
Parameter | Description |
speed | Optional. Specifies the speed at which an element changes from the current transparency to the specified transparency. Possible values: milliseconds (e.g. 1500) "slow" "normal" "fast" |
opacity | Required. Specifies the transparency to fade in or out. Must be a number between 0.00 and 1.00. |
callback | Optional. The function to be executed after the fadeTo function is executed. To learn more about callbacks, visit our jQuery Callback chapter. This parameter cannot be set unless the speed parameter is set. |
jquery fadeTo() method example
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".btn1").click(function(){ $("p").fadeTo(1000,0.4); }); }); </script> </head> <body> <p>This is a paragraph.</p> <button class="btn1">FadeTo</button> </body> </html>
Click the "Run instance" button to view the online instance