How can I use delay()
with show()
and hide()
in Jquery ?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
Pass a duration to
show()
andhide()
:E.g.
element.delay(1000).show(0)
DEMO
The easiest way is to make a "fake show" by using 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.
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/