[jQuery 核心-数据缓存] queue([name])

返回指向第一个匹配元素的队列(将是一个函数数组)。

返回值
Array

参数
name (String) :队列名,默认为fx

示例
显示队列长度

HTML 代码:[code]
div { margin:3px; width:40px; height:40px;
position:absolute; left:0px; top:30px;
background:green; display:none; }
div.newcolor { background:blue; }
span { color:red; }

Show Length of Queue

[/code]jQuery 代码:[code]$("#show").click(function () { var n = $("div").queue("fx"); $("span").text("Queue length is: " + n.length); }); function runIt() { $("div").show("slow"); $("div").animate({left:'+=200'},2000); $("div").slideToggle(1000); $("div").slideToggle("fast"); $("div").animate({left:'-=200'},1500); $("div").hide("slow"); $("div").show(1200); $("div").slideUp("normal", runIt); } runIt(); [/code]