jQuery .delay()
.delay()
.delay( duration [, queueName ] )Returns: jQuery
Description: Set a timer to delay execution of subsequent items in the queue.
-
version added: 1.4.delay( duration [, queueName ] )
Added to jQuery in version 1.4, the .delay()
method allows us to delay the execution of functions that follow it in the queue. It can be used with the standard effects queue or with a custom queue. Only subsequent events in a queue are delayed; for example this will not delay the no-arguments forms of .show()
or .hide()
which do not use the effects queue.
Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings 'fast'
and 'slow'
can be supplied to indicate durations of 200 and 600 milliseconds, respectively.
Using the standard effects queue, we can, for example, set an 800-millisecond delay between the .slideUp()
and .fadeIn()
of <div id="foo">
:
$( "#foo" ).slideUp( 300 ).delay( 800 ).fadeIn( 400 );
When this statement is executed, the element slides up for 300 milliseconds and then pauses for 800 milliseconds before fading in for 400 milliseconds.
The .delay()
method is best for delaying between queued jQuery effects. Because it is limited—it doesn't, for example, offer a way to cancel the delay—.delay()
is not a replacement for JavaScript's native setTimeout function, which may be more appropriate for certain use cases.
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2018-07-12 网上职位要求对照
2018-07-12 Use of implicitly declared global variable
2018-07-12 ResolveUrl in external JavaScript file in asp.net project
2018-07-12 data-toggle data-target
2017-07-12 字符编码
2015-07-12 Which are in?
2015-07-12 IQ Test