jQueue dequeue()

jQuery deQueue() function removes the next function waiting to execute in the queue of the selected elements. To ensure that process is running, you must make sure that this method should be called only after the addition of a function with queue() method.

jQuery deQueue()函数删除在所选元素的队列中等待执行的下一个函数。 为了确保进程正在运行,必须确保仅在使用queue()方法添加函数之后才应调用此方法。

jQuery deQueue() (jQuery deQueue())

Here is the general syntax to use jQuery deQueue() method.

这是使用jQuery deQueue()方法的常规语法。

selector.deQueue(QueueName);

selector.deQueue(QueueName);

QueueName is an optional argument which is a string with the name of the queue. Default value is fx, which is the standard effects queue.

QueueName是一个可选参数,它是带有队列名称的字符串。 默认值为fx,这是标准效果队列。

jQuery dequeue()示例 (jQuery dequeue() example)

Following example demonstrates the use of deQueue method. A queue of functions gets executed by clicking the start Animation button.

以下示例演示了deQueue方法的deQueue 。 单击开始“动画”按钮将执行功能队列。

<!doctype html>
<html>
<head>
<title>jQuery Dequeue Method</title>
<style>
div {
height: 60px;
margin: 5px;
width: 60px;
position: absolute;
left: 10px;
top: 50px;
background-color: red;
}
div.green{
background-color: green;
}
</style>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
</head>
<body>
<button>Start Animation</button>
<div></div>
<script>
$( "button" ).click(function() {
$( "div" )
.animate({ left:"200px" }, 1500 )
.animate({ top:"0px" }, 700 )
.queue(function() {
$( this ).toggleClass( "green" ).dequeue();
})
.animate({ left:"100px", top:"30px" }, 800 );
});
</script>
</body>
</html>

jQuery deQueue() method removes the next non-executed functions from the queue. If nothing is passed as an argument, then the deQueue method will remove the functions from the standard effects queue.

jQuery deQueue()方法从队列中删除下一个未执行的函数。 如果没有传递任何参数作为参数,则deQueue方法将从标准效果队列中删除这些功能。

jQuery出队演示 (jQuery dequeue demo)

jQuery deQueue() method is always used with queue() method and if not used, the queue will not be closed and you will get undesired result.

jQuery deQueue()方法始终与queue()方法一起使用,如果不使用,队列将不会关闭,您将得到不想要的结果。

翻译自: https://www.journaldev.com/4705/jqueue-dequeue

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值