jQuery ??? ? ? ??? ??
jQuery? ???? ??? ??? ??? ?? ? ????.
jQuery ??? ??
jQuery? ???? ??? ??? ??? ?? ? ????.
jQuery?? ?? ? ?? ??? ???? ????.
fadeIn()
fadeOut()
fadeToggle()
fadeTo()
jQuery fadeIn() ???
jQuery fadeIn()? ??? ??? ??? ??? ? ?????.
??:
$(selector).fadeIn(speed,callback);
???? ?? ????? ??? ?? ??? ?????. "??", "??" ?? ??? ?? ??? ? ????. .
???? ?? ????? ???? ??? ? ??? ??? ?????.
?? ???? ??? ?? ??? ???? fadeIn() ???? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("#div1").fadeIn(); $("#div2").fadeIn("slow"); $("#div3").fadeIn(3000); }); }); </script> </head> <body> <p>以下實例演示了 fadeIn() 使用了不同參數(shù)的效果。</p> <button>點擊淡入 div 元素。</button> <br><br> <div id="div1" style="width:80px;height:80px;display:none;background-color:red;"></div><br> <div id="div2" style="width:80px;height:80px;display:none;background-color:green;"></div><br> <div id="div3" style="width:80px;height:80px;display:none;background-color:blue;"></div> </body> </html>
????? ???? ??? ???
jQuery fadeOut() ???
jQuery fadeOut() ???? ?? ??? ??? ??? ?????. ??.
??:
$(selector).fadeOut(speed,callback);
???? ?? ????? ??? ?? ??? ?????. "??", "??" ?? ??? ?? ??? ? ????.
???? ?? ????? ???? ??? ? ??? ??? ?????.
?? ???? ??? ?? ??? ???? fadeOut() ???? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("#div1").fadeOut(); $("#div2").fadeOut("slow"); $("#div3").fadeOut(3000); }); }); </script> </head> <body> <p>以下實例演示了 fadeOut() 使用了不同參數(shù)的效果。</p> <button>點擊淡出 div 元素。</button> <br><br> <div id="div1" style="width:80px;height:80px;background-color:red;"></div><br> <div id="div2" style="width:80px;height:80px;background-color:green;"></div><br> <div id="div3" style="width:80px;height:80px;background-color:blue;"></div> </body> </html>
????? ???? ??? ???
jQuery fadeToggle() ???
jQuery fadeToggle() ???? fadeIn()? fadeOut() ??? ??? ??? ? ????.
fadeToggle()? ?? ??? ??? ??? ??? ? ??? ?????.
fadeToggle()? ?? ??? ?? ??? ??? ?? ??? ?????.
??:
$(selector).fadeToggle(speed,callback);
???? ?? ????? ??? ?? ??? ?????. "??", "??" ?? ??? ?? ??? ? ????.
???? ?? ????? ???? ??? ? ??? ??? ?????.
?? ???? ??? ?? ??? ?? fadeToggle() ???? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP中文網(wǎng)(php.cn)</title> <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("#div1").fadeToggle(); $("#div2").fadeToggle("slow"); $("#div3").fadeToggle(3000); }); }); </script> </head> <body> <p>實例演示了 fadeToggle() 使用了不同的 speed(速度) 參數(shù)。</p> <button>點擊淡入/淡出</button> <br><br> <div id="div1" style="width:80px;height:80px;background-color:red;"></div> <br> <div id="div2" style="width:80px;height:80px;background-color:green;"></div> <br> <div id="div3" style="width:80px;height:80px;background-color:blue;"></div> </body> </html>
????? ???? ??? ???
jQuery fadeTo() ???
jQuery fadeTo() ???? ???? ?????? ???? ??? ? ????. ??? ? ???(0? 1 ??? ?).
??:
$(selector).fadeTo(speed,opacity,callback);
?? ?? ????? ??? ?? ??? ?????. "??", "??" ?? ??? ?? ??? ? ????.
fadeTo() ???? ?? ???? ????? ??? ??? ??? ????(0?? 1 ??? ?)? ?????.
??? ?? ????? ??? ??? ? ??? ??? ?????.
?? ????? ??? ?? ??? ???? fadeTo() ???? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("#div1").fadeTo("slow",0.15); $("#div2").fadeTo("slow",0.4); $("#div3").fadeTo("slow",0.7); }); }); </script> </head> <body> <p>演示 fadeTo() 使用不同參數(shù)</p> <button>點我讓顏色變淡</button> <br><br> <div id="div1" style="width:80px;height:80px;background-color:red;"></div><br> <div id="div2" style="width:80px;height:80px;background-color:green;"></div><br> <div id="div3" style="width:80px;height:80px;background-color:blue;"></div> </body> </html>
????? ???? ??? ???