国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

jQuery 效果- 隱藏和顯示

hide() 和 show()

通過 jQuery,您可以使用 hide() 和 show() 方法來隱藏和顯示 HTML 元素:

語法:

$(selector).hide(speed,callback);

$(selector).show(speed,callback);

可選的 speed 參數(shù)規(guī)定隱藏/顯示的速度,可以取以下值:"slow"、"fast" 或毫秒。

可選的 callback 參數(shù)是隱藏或顯示完成后所執(zhí)行的函數(shù)名稱。

<!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>
<p>這是第二個</p>
</body>
</html>

jQuery toggle()

通過 jQuery,您可以使用 toggle() 方法來切換 hide() 和 show() 方法。

顯示被隱藏的元素,并隱藏已顯示的元素:

語法:

$(selector).toggle(speed,callback);

可選的 speed 參數(shù)規(guī)定隱藏/顯示的速度,可以取以下值:"slow"、"fast" 或毫秒。

可選的 callback 參數(shù)是 toggle() 方法完成后所執(zhí)行的函數(shù)名稱。

<!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>再點擊一次顯示</p>
</body>
</html>


繼續(xù)學(xué)習(xí)
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script> <style type="text/css"> .big{ font-size:30px; color:#FF0000;} </style> </head> <body> <script> $(function(){ $('#click_event').click(function(){ $('#click_event').html(''); if($('#hidden_enent').is(':hidden')) { $('#hidden_enent').show(); $('#click_event').html('隱藏'); } else { $('#hidden_enent').hide(); $('#click_event').html('顯示'); } }) }) </script> <div id="click_event" style="cursor:pointer">隱藏</div> <div id="hidden_enent">測試隱藏</div> </body> </html>
提交重置代碼