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

.hide()

.hide( ) Returns: jQuery

Description: 隱藏匹配的元素。

  • version added: 1.0.hide()

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

    duration一個(gè)字符串或者數(shù)字決定動(dòng)畫(huà)將運(yùn)行多久。

    callback在動(dòng)畫(huà)完成時(shí)執(zhí)行的函數(shù)。

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

    duration一個(gè)字符串或者數(shù)字決定動(dòng)畫(huà)將運(yùn)行多久。

    easing一個(gè)字符串,指示該函數(shù)使用緩和的過(guò)渡。

    callback在動(dòng)畫(huà)完成時(shí)執(zhí)行的函數(shù)。

如果沒(méi)有參數(shù),.hide()方法是最簡(jiǎn)單的方法來(lái)隱藏一個(gè)元素:

$('.target').hide();

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

當(dāng)提供一個(gè)持續(xù)時(shí)間參數(shù),.hide()成為一個(gè)動(dòng)畫(huà)方法。.hide()方法將為匹配元素的寬度,高度,以及不透明度,同時(shí)進(jìn)行動(dòng)畫(huà)。一旦透明度達(dá)到0,display樣式屬性將被設(shè)置為none,這個(gè)元素將不再在頁(yè)面中影響布局。

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

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

我們可以給任何元素做動(dòng)畫(huà),比如一個(gè)簡(jiǎn)單的圖片:

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

例子:

舉例: 點(diǎn)擊鏈接隱藏所有段落。

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <p>Hello</p>
  <a href="#">Click to hide me too</a>
  <p>Here is another paragraph</p>
<script>

    $("p").hide();
    $("a").click(function () {
      $(this).hide();
      return true;
    });
</script>

</body>
</html>

Demo:

舉例: 緩慢的隱藏所有顯示的段落,600毫秒內(nèi)完成的動(dòng)畫(huà)。

<!DOCTYPE html>
<html>
<head>
  <style>
  p { background:#dad; font-weight:bold; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <button>Hide 'em</button>

  <p>Hiya</p>
  <p>Such interesting text, eh?</p>
<script>
    $("button").click(function () {
      $("p").hide("slow");
    });    
</script>

</body>
</html>

Demo:

舉例: Animates all spans (words in this case) to hide fastly, completing each animation within 200 milliseconds. Once each animation is done, it starts the next one.

<!DOCTYPE html>
<html>
<head>
  <style>
  span { background:#def3ca; padding:3px; float:left; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <button id="hidr">Hide</button>
  <button id="showr">Show</button>
  <div>

    <span>Once</span> <span>upon</span> <span>a</span> 
    <span>time</span> <span>there</span> <span>were</span> 
    <span>three</span> <span>programmers...</span>

  </div>
<script>
    $("#hidr").click(function () {
      $("span:last-child").hide("fast", function () {
        // use callee so don't have to name the function
        $(this).prev().hide("fast", arguments.callee); 
      });
    });
    $("#showr").click(function () {
      $("span").show(2000);
    });

</script>

</body>
</html>

Demo:

Example: Hides the divs when clicked over 2 seconds, then removes the div element when its hidden. Try clicking on more than one box at a time.

<!DOCTYPE html>
<html>
<head>
  <style>
  div { background:#ece023; width:30px; 
        height:40px; margin:2px; float:left; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <div></div>
<script>
    for (var i = 0; i < 5; i++) {
      $("<div>").appendTo(document.body);
    }
    $("div").click(function () {
      $(this).hide(2000, function () {
        $(this).remove();
      });
    });
</script>

</body>
</html>

Demo:

jQuery 1.6 API 中文版腳本之家整理、修訂 (2011年6月)
赫章县| 神农架林区| 嘉义县| 新丰县| 太和县| 嘉义县| 鱼台县| 吴桥县| 祁阳县| 聂拉木县| 丰宁| 三穗县| 山东省| 美姑县| 类乌齐县| 朝阳区| 双桥区| 阳原县| 福泉市| 崇文区| 呼和浩特市| 长寿区| 金堂县| 永胜县| 民和| 通河县| 东明县| 监利县| 昌邑市| 中方县| 宁阳县| 张家港市| 丹巴县| 凤山县| 韶关市| 孙吴县| 镶黄旗| 宜章县| 房山区| 正阳县| 沁水县|