ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
### 返回值:jQuerydequeue([queueName]) ### 概述 从队列最前端移除一个队列函数,并执行他。 ### 参数 #### **[queueName]**String*V1.2* 队列名,默认为fx ### 示例 #### 描述: 使用 dequeue() 终止一个自定义的队列函数 ##### jQuery 代码: ~~~ $("div").queue(function () { $(this).toggleClass("red"); $(this).dequeue(); }); ~~~ #### 描述: 用dequeue来结束自定义队列函数,并让队列继续进行下去。 ##### HTML 代码: ~~~ <style> div { margin:3px; width:50px; position:absolute; height:50px; left:10px; top:30px; background-color:yellow; } div.red { background-color:red; } </style> <button>Start</button> <div></div> ~~~ ##### jQuery 代码: ~~~ $("button").click(function () { $("div").animate({left:'+=200px'}, 2000); $("div").animate({top:'0px'}, 600); $("div").queue(function () { $(this).toggleClass("red"); $(this).dequeue(); }); $("div").animate({left:'10px', top:'30px'}, 700); }); ~~~