Definition and usage
The delay () method sets the latency for the execution of the next item in the queue.
Syntax $ (selector). Delay (Speed,queuename)
| Parameters |
Description |
| Speed |
Optional. Specify the speed of the delay.
Possible values:
- Milliseconds
- "Slow"
- "Fast"
|
| QueueName |
Optional. Specifies the name of the queue.
The default is "FX", the standard effect queue. |
Instance Code
<Scriptsrc= "Http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></Script><Script>$ (document). Ready (function(){ $("Button"). Click (function(){ $("#div1"). Delay ("Slow"). FadeIn (); $("#div2"). Delay ("Fast"). FadeIn (); $("#div3"). Delay ( -). FadeIn (); $("#div4"). Delay ( -). FadeIn (); $("#div5"). Delay (4000). FadeIn (); });});</Script></Head><Body><P>This instance uses the delay () method to set different speed values.</P><Button>Click the button to display multiple div boxes.</Button><BR><BR><DivID= "Div1"style= "Width:90px;height:90px;display:none;background-color:black;"></Div><BR><DivID= "Div2"style= "Width:90px;height:90px;display:none;background-color:green;"></Div><BR><DivID= "Div3"style= "Width:90px;height:90px;display:none;background-color:blue;"></Div><BR><DivID= "Div4"style= "width:90px;height:90px;display:none;background-color:red;"></Div><BR><DivID= "DIV5"style= "width:90px;height:90px;display:none;background-color:purple;"></Div><BR></Body></HTML>
JQuery Delay () method