最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

.show()

.show( ) 返回: jQuery

說明: 顯示匹配的元素。

  • version added: 1.0.show()

  • version added: 1.0.show( duration, [ callback ] )

    duration一個字符串或者數(shù)字決定動畫將運(yùn)行多久。

    callback在動畫完成時執(zhí)行的函數(shù)。

  • version added: 1.4.3.show( [ duration ], [ easing ], [ callback ] )

    duration一個字符串或者數(shù)字決定動畫將運(yùn)行多久。

    easing一個用來表示使用哪個緩沖函數(shù)來過渡的字符串。

    callback在動畫完成時執(zhí)行的函數(shù)。

如果沒有參數(shù),.show()方法是最簡單的方法來顯示一個元素:

$('.target').show();

匹配的元素將被立即顯示,沒有動畫。這大致相當(dāng)于調(diào)用.css('display', 'block'),但display屬性值保存在jQuery的數(shù)據(jù)緩存中,所以display可以方便以后可以恢復(fù)到其初始值。如果一個元素的display屬性值為inline,然后是隱藏和顯示,這個元素將再次顯示inline。

當(dāng)提供一個持續(xù)時間參數(shù),.show()成為一個動畫方法。.show()方法將為匹配元素的寬度,高度,以及不透明度,同時進(jìn)行動畫。

持續(xù)時間是以毫秒為單位的,數(shù)值越大,動畫越慢,不是越快。字符串 'fast''slow' 分別代表200和600毫秒的延時。

如果提供回調(diào)函數(shù)參數(shù),回調(diào)函數(shù)會在動畫完成的時候調(diào)用。這個對于將不同的動畫串聯(lián)在一起按順序排列是非常有用的。這個回調(diào)函數(shù)不設(shè)置任何參數(shù),但是this是存在動畫的DOM元素,如果多個元素一起做動畫效果,值得注意的是每執(zhí)行一次回調(diào)匹配的元素,而不是作為一個整體的動畫一次。

我們可以給任何元素做動畫,比如一個簡單的圖片:

<div id="clickme">
  Click here
</div>
<img id="book" src="book.png" alt="" width="100" height="123" />
With the element initially hidden, we can show it slowly:
$('#clickme').click(function() {
  $('#book').show('slow', function() {
    // Animation complete.
  });
});

Examples:

Example: 緩慢地顯示所有隱藏的段落,600毫秒內(nèi)完成的動畫。

<!DOCTYPE html>
<html>
<head>
  <style>
      p { background:yellow; }
      </style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <button>Show it</button>

      <p style="display: none">Hello  2</p>
<script>
    $("button").click(function () {
    $("p").show("slow");
    });
    </script>

</body>
</html>

Demo:

Example: Animates all hidden divs to show fastly in order, completing each animation within 200 milliseconds. Once each animation is done, it starts the next one.

<!DOCTYPE html>
<html>
<head>
  <style>
  div { background:#def3ca; margin:3px; width:80px; 
  display:none; float:left; text-align:center; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  
  <button id="showr">Show</button>
  <button id="hidr">Hide</button>
  <div>Hello 3,</div>

  <div>how</div>
  <div>are</div>
  <div>you?</div>
<script>
$("#showr").click(function () {
  $("div:eq(0)").show("fast", function () {
    /* use callee so don't have to name the function */
    $(this).next("div").show("fast", arguments.callee);
  });
});
$("#hidr").click(function () {
  $("div").hide(2000);
});

</script>

</body>
</html>

Demo:

Example: Shows all span and input elements with an animation. Once the animation is done, it changes the text.

<!DOCTYPE html>
<html>
<head>
  <style>
  span { display:none; }
  div { display:none; }
  p { font-weight:bold; background-color:#fcd; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <button>Do it!</button>
  <span>Are you sure? (type 'yes' if you are) </span>
  <div>
    <form>
      <input type="text"  value="as;ldkfjalsdf"/>
    </form>
  </div>
  <p style="display:none;">I'm hidden...</p>
  
<script>
function doIt() {
  $("span,div").show("slow");
}
/* can pass in function name */
$("button").click(doIt);

$("form").submit(function () {
  if ($("input").val() == "yes") {
    $("p").show(4000, function () {
      $(this).text("Ok, DONE! (now showing)");
    });
  }
  $("span,div").hide("fast");
  /* to stop the submit */
  return false; 
});
</script>

</body>
</html>

Demo:

jQuery 1.6 API 中文版腳本之家整理、修訂 (2011年6月)
迁西县| 天镇县| 赤壁市| 陇南市| 铜山县| 满洲里市| 上栗县| 绥棱县| 长岭县| 会理县| 兖州市| 措勤县| 商都县| 南康市| 织金县| 山阳县| 乐山市| 手游| 班戈县| 铜川市| 金昌市| 阜平县| 桃园市| 西昌市| 南召县| 文成县| 集贤县| 库伦旗| 岳普湖县| 西贡区| 太保市| 吉水县| 龙南县| 江安县| 闻喜县| 石屏县| 台安县| 根河市| 鄂托克前旗| 登封市| 昔阳县|