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

.promise()

.promise( [ type ], [ target ] ) 返回: Promise

描述: 返回一個 Promise 對象用來觀察當(dāng)某種類型的所有行動綁定到集合,排隊(duì)與否還是已經(jīng)完成。

  • version added: 1.6.promise( [ type ], [ target ] )

    type 需要待觀察隊(duì)列類型。

    target附有promise 方法的Object

.promise()方法返回一個動態(tài)生成的Promise對象用來觀察當(dāng)某種類型的所有行動綁定到集合,排隊(duì)與否還是已經(jīng)完成。

默認(rèn)情況下, type"fx" ,這意味著當(dāng)選定的元素已完成所有動畫是返回的Promise是解決的。

解決上下文和唯一的參數(shù)是哪個集合到.promise()被調(diào)用。

如果target是提供,.promise()將附加到它的方法,然后返回這個對象,而不是創(chuàng)建一個新的。這對在已經(jīng)存在的對象上附加Promise的行為非常有用。

Examples:

Example: 一個集合上使用promise,而沒有動畫解決的promise:


var div = $( "<div />" );

div.promise().done(function( arg1 ) {
  // will fire right away and alert "true"
  alert( this === div && arg1 === div );
});

Example: Resolve the returned Promise when all animations have ended (including those initiated in the animation callback or added later on):

<!DOCTYPE html>
<html>
<head>
  <style>
div {
  height: 50px; width: 50px;
  float: left; margin-right: 10px;
  display: none; background-color: #090;
}
</style>
  <script src="http://code.jquery.com/jquery-git.js"></script>
</head>
<body>
  
<button>Go</button>
<p>Ready...</p>
<div></div>
<div></div>
<div></div>
<div></div>


<script>
$("button").bind( "click", function() {
  $("p").append( "Started...");
  
  $("div").each(function( i ) {
    $( this ).fadeIn().fadeOut( 1000 * (i+1) );
  });

  $( "div" ).promise().done(function() {
    $( "p" ).append( " Finished! " );
  });
});
</script>

</body>
</html>

Demo:

Example: Resolve the returned Promise using a $.when() statement (the .promise() method makes it possible to do this with jQuery collections):

<!DOCTYPE html>
<html>
<head>
  <style>
div {
  height: 50px; width: 50px;
  float: left; margin-right: 10px;
  display: none; background-color: #090;
}
</style>
  <script src="http://code.jquery.com/jquery-git.js"></script>
</head>
<body>
  
<button>Go</button>
<p>Ready...</p>
<div></div>
<div></div>
<div></div>
<div></div>


<script>
var effect = function() {
  return $("div").fadeIn(800).delay(1200).fadeOut();
};

$("button").bind( "click", function() {
  $("p").append( " Started... ");

  $.when( effect() ).done(function() {
    $("p").append(" Finished! ");
  });
});

</script>

</body>
</html>

Demo:

jQuery 1.6 API 中文版腳本之家整理、修訂 (2011年6月)
平安县| 泸水县| 义乌市| 博爱县| 清河县| 玉林市| 桃源县| 三江| 福鼎市| 家居| 开江县| 乡宁县| 张家界市| 襄汾县| 齐河县| 古田县| 甘德县| 海丰县| 城口县| 百色市| 江安县| 余庆县| 方正县| 会东县| 泽州县| 秭归县| 蓬莱市| 清新县| 石河子市| 岐山县| 榆林市| 新民市| 西华县| 黎平县| 绿春县| 札达县| 普宁市| 桦川县| 鹤山市| 永靖县| 屏山县|