jQuery ??? ? ??
jQuery hide() ? show()
jQuery??? hide() ? show() ???? ???? HTML ??? ??? ??? ? ????.
Example
<!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(){ $("#hide").click(function(){ $("p").hide(); }); $("#show").click(function(){ $("p").show(); }); }); </script> </head> <body> <p>如果你點(diǎn)擊“隱藏” 按鈕,我將會(huì)消失。</p> <button id="hide">隱藏</button> <button id="show">顯示</button> </body> </html>
????? ???? ??? ???. it
??:
$(selector).hide(speed,callback);
$(selector).show(speed,callback);
???? speed ????? ??? ??? ?????. hide/showing ? "slow(??)", "fast(??)" ?? ??? ?? ??? ? ????.
??? ?? ????? ??? ?? ??? ??? ? ??? ??? ?????.
?? ???? ?? ????? ?? hide() ???? ?????.
<!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(){ $("p").hide(1000); }); }); </script> </head> <body> <button>隱藏</button> <p>生活就是做出選擇,一旦你做出了你的選擇,你就必須活在你的決定中。</p> </body> </html>
????? ???? ??? ???
jQuery ??()
jQuery??? ??() ???? ??? ? ????. hide() ? show() ???? ?????.
??? ?? ?? ? ??? ?? ???:
<!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(){ $("p").toggle(); }); }); </script> </head> <body> <button>隱藏/顯示</button> <p>真正的失敗不是你沒有做成事,而是你甘心于失敗。</p> <p>一切都會(huì)好起來的,即使不是在今天,總有一天會(huì)的。</p> </body> </html>
????? ???? ??? ???
??:
$(selector).toggle(speed,callback);
? ??? ?? ????? ???/?? ??? ???? "??", "??" ?? ??? ?? ??? ? ????.
???? ?? ????? ??() ???? ??? ? ??? ??? ?????.