jQuery.queue(element, queueName, newQueue)
version 1.3 以降
解説
マッチした要素のキューを、指定されたキューで置き換えます。
通常の使用では、jQueryオブジェクトに対するメソッドの queue([queueName], newQueue) の方が使いやすいです。
引数
-
element
Element: DOM要素
-
queueName
String: キューの名前。
-
newQueue
Array<Function>: 置き換える関数の配列
戻り値
例
例1:アニメーションが実行される毎に、キュー内の関数の数を表示します。
$("#test1_run").click(function(){
$("#block")
.animate({height: "0px", opacity: 0.2}, 1500, showQueueLength)
.animate({height: "200px", opacity: 1.0}, 2000, showQueueLength)
.animate({fontSize: "2.0em"}, 1500, showQueueLength)
.animate({width: "150px"}, 1500, showQueueLength)
.animate({fontSize: "1.0em"}, 1500, showQueueLength)
.animate({width: "100px"}, 2000, showQueueLength)
showQueueLength();
});
function showQueueLength(){
$("#count").text($("#block").queue().length);
};
$("#test1_clear").click(function(){
$.queue(document.getElementById("block"), "fx", []);
$("#block").stop();
showQueueLength();
});
|