欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery中hide()方法用法實(shí)例

 更新時(shí)間:2014年12月24日 10:13:06   投稿:shichen2014  
這篇文章主要介紹了jQuery中hide()方法用法,以實(shí)例形式較為詳細(xì)的分析了hide()方法的定義、功能與使用技巧,具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了jQuery中hide()方法用法。分享給大家供大家參考。具體分析如下:

此方法可以將匹配元素隱藏。

hide()方法的用法:
此方法如果沒有對(duì)隱藏效果加以時(shí)間限定,那么匹配元素會(huì)被瞬間隱藏。例如:

復(fù)制代碼 代碼如下:
$("div").hide()

以上代碼可以將所有div元素瞬間隱藏。
如果方法對(duì)隱藏效果加以時(shí)間限定,那么匹配元素將會(huì)在限定的事件內(nèi)以比較優(yōu)雅的形式隱藏。例如:
復(fù)制代碼 代碼如下:
$("div").hide(2000)

以上代碼可以將所有div元素在2000毫秒(2秒)內(nèi)隱藏。
此方法也可以在隱藏完成后觸發(fā)一個(gè)回調(diào)函數(shù)。例如:
復(fù)制代碼 代碼如下:
$("div").hide(2000,function(){alert("我隱藏好了")});

實(shí)例代碼:

復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.dbjr.com.cn/" />
<title>hide()函數(shù)-腳本之家</title>
<style type="text/css">
div{
  color:blue;
  background-color:green;
  width:100px;
  height:100px;
  margin-top:10px;
}
</style>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("#first").click(function(){
    $(".first").hide();
  })
  $("#second").click(function(){
    $(".second").hide(2000,function(){alert("我隱藏好了")});
  })
})
</script>
</head>
<body>
  <div class="first"></div>
  <div class="second"></div>
  <button id="first">瞬間隱藏</button>
  <button id="second">優(yōu)雅的隱藏</button>
</body>
</html>

以上代碼能夠在隱藏完成以后觸發(fā)回調(diào)函數(shù),于是彈出一個(gè)提示框。

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論