ホームページ  >  記事  >  ウェブフロントエンド  >  jquery late() の概要と使用法 guide_jquery

jquery late() の概要と使用法 guide_jquery

WBOY
WBOYオリジナル
2016-05-16 16:37:581136ブラウズ

遅延(期間,[キュー名])

遅延を設定して、キュー内の後続のアイテムの実行を遅らせます。
jQuery 1.4の新機能。キュー内の関数の実行を遅らせるために使用されます。アニメーション キューの実行を遅らせることも、カスタム キューで使用することもできます。

期間: 遅延時間、単位: ミリ秒

queueName: キュー名詞、デフォルトは Fx、アニメーションキューです。

テーブル>

<!DOCTYPE html>
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
 $("button").click(function(){
  $("#div1").delay("slow").fadeIn();
  $("#div2").delay("fast").fadeIn();
  $("#div3").delay(800).fadeIn();
  $("#div4").delay(2000).fadeIn();
  $("#div5").delay(4000).fadeIn();
 });
});
</script>
</head>

<body>
<p>This example sets different speed values for the delay() method.</p>
<button>Click to fade in boxes with a delay</button>
<br><br>
<div id="div1" style="width:90px;height:90px;display:none;background-color:black;"></div><br>
<div id="div2" style="width:90px;height:90px;display:none;background-color:green;"></div><br>
<div id="div3" style="width:90px;height:90px;display:none;background-color:blue;"></div><br>
<div id="div4" style="width:90px;height:90px;display:none;background-color:red;"></div><br>
<div id="div5" style="width:90px;height:90px;display:none;background-color:purple;"></div><br>
</body>
</html>
完全なテストコード:

例:
$(document).ready(function() {
 $('#header')
 .css({ 'top':-50 })
 .delay(1000)
 .animate({'top': 0}, 800);

 $('#footer')
 .css({ 'bottom':-15 })
 .delay(1000)
 .animate({'bottom': 0}, 800); 
});
頭と底部の遅延読み込みアニメーション効果

パラメータ 説明
速度 オプション。ディレイの速さを指定します。
参数 描述
speed 可选。规定延迟的速度。

可能的值:

  • 毫秒
  • "slow"
  • "fast"
queueName 可选。规定队列的名称。

默认是 "fx",标准效果队列。
可能な値:
  • ミリ秒
  • 「遅い」
  • 「速い」
キュー名 オプション。キューの名前を指定します。
$("button").click(function(){
$("#div1").delay("slow").fadeIn();
$("#div2").delay("fast").fadeIn();
}); 
デフォルトは「fx」、標準のエフェクトキューです。
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。