標籤:執行個體 用法 http reference cdn document 預設 table html
定義和用法
delay() 方法對隊列中的下一項的執行設定延遲。
文法$(selector).delay(speed,queueName)
| 參數 |
描述 |
| speed |
可選。規定延遲的速度。
可能的值:
|
| queueName |
可選。規定隊列的名稱。
預設是 "fx",標準效果隊列。 |
執行個體代碼
<script src="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(800).fadeIn(); $("#div4").delay(2000).fadeIn(); $("#div5").delay(4000).fadeIn(); });});</script></head><body><p>這個執行個體使用 delay() 方法來設定不同的速度值。 </p><button>點擊按鈕,顯示多個的 div 框。</button><br><br><div id="div1" style="width:90px;height:90px;display:none;background-color:black;"></div><br><div id="div2" style="width:90px;height:90px;display:none;background-color:green;"></div><br><div id="div3" style="width:90px;height:90px;display:none;background-color:blue;"></div><br><div id="div4" style="width:90px;height:90px;display:none;background-color:red;"></div><br><div id="div5" style="width:90px;height:90px;display:none;background-color:purple;"></div><br></body></html>
jQuery delay() 方法