如何在Jquery中将delay()与show()和hide()一起使用
如何在 Jquery 中将 delay()
与 show()
和 hide()
一起使用?
How can I use delay()
with show()
and hide()
in Jquery ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
将持续时间传递给
show()
和hide()
:例如
element.delay(1000).show(0)
DEMO< /a>
Pass a duration to
show()
andhide()
:E.g.
element.delay(1000).show(0)
DEMO
最简单的方法就是用jquery制作一个“假节目”。
The easiest way is to make a "fake show" by using jquery.
为什么不尝试fadeIn()而不是使用带有delay()的show()。
我认为你想做的事情可以用这个来完成。
下面是 fadeIn 和 FadeOut() 的 jQuery 代码,它也有用于延迟过程的内置方法。
Why don't you try the fadeIn() instead of using a show() with delay().
I think what you are trying to do can be done with this.
Here is the jQuery code for fadeIn and FadeOut() which also has inbuilt method for delaying the process.
来自 jquery api
在 1.4 版本中添加到 jQuery 中,
.delay()
方法允许我们延迟执行队列中跟随它的函数。它可以与标准效果队列或自定义队列一起使用。仅延迟队列中的后续事件;例如,这不会延迟不使用效果队列的.show()
或.hide()
的无参数形式。http://api.jquery.com/delay/
from jquery api
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.http://api.jquery.com/delay/
此信息需要更新。
我今天看到这个是因为我需要延迟 div 的显示。我正在使用 jQuery 3.4.1 并对此进行了测试。
This info needs updating.
I was looking at this today because I needed to delay the showing of a div. I'm using jQuery 3.4.1 and have tested this.