jquery delay_jQuery delay()函数
jquery delay
jQuery delay function is used to delay the execution of items in the queue. This method sets a timer to delay the execution.
jQuery延遲功能用于延遲隊列中項目的執行。 此方法設置計時器以延遲執行。
jQuery delay() (jQuery delay())
Here is the general syntax for using jQuery delay() function:
這是使用jQuery delay()函數的一般語法:
selector.delay(Integer speed, String queueName)
selector.delay(Integer speed, String queueName)
speed defines the duration of the delay effect. Durations are specified in milliseconds.
速度定義延遲效果的持續時間。 持續時間以毫秒為單位。
queueName is the name of the queue on which delay function will execute. This is an optional argument. Default value is fx which is the standard effects queue.
queueName是將在其上執行延遲功能的隊列的名稱。 這是一個可選參數。 默認值為fx ,這是標準效果隊列。
jQuery延遲功能 (jQuery delay function)
Following example demonstrates the application of jQuery delay function to delay animation.
下面的示例演示了jQuery延遲函數在延遲動畫中的應用。
<!doctype html> <html> <head> <title>jQuery delay Function</title> <style> div { position: absolute; width: 70px; height: 70px; float: left; } .div1{ background-color: red; left: 0; } .div2{ background-color: black; left: 80px; } </style> <script src="jquery-3.2.1.min.js"></script> </head> <body> <p><button>jQuery Delay Demo</button></p> <div class="div1"></div> <div class="div2"></div> <script> $( "button" ).click(function() { $( "div.div1" ).toggle( 300 ).delay( 2000 ).fadeIn( 400 ); $( "div.div2" ).toggle( 300 ).slideDown( 1000 ); }); </script> </body> </html>As you can see that in above example, fadeIn effect is delayed by 2 seconds using jQuery delay() function.
如您所見,在上面的示例中,使用jQuery delay()函數將fadeIn效果延遲了2秒。
Below image shows the jQuery delay function usage in action to delay animation.
下圖顯示了用于延遲動畫的jQuery延遲函數用法。
jQuery延遲動畫直播演示 (jQuery delay animation live demo)
Click on the below button to see the above example output.
單擊下面的按鈕以查看上面的示例輸出。
演示地址
jQuery delay function is very helpful for jQuery animation. This method is added to the 1.4 version of jQuery. This method is used at its best to delay the queued effects in jQuery.
jQuery延遲功能對于jQuery動畫非常有用。 此方法已添加到jQuery的1.4版本中。 最好使用此方法來延遲jQuery中排隊的效果。
Reference: API Doc
參考: API文檔
翻譯自: https://www.journaldev.com/4652/jquery-delay-function
jquery delay
總結
以上是生活随笔為你收集整理的jquery delay_jQuery delay()函数的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 跟随艺术家林曦的脚步 学习“只生欢喜不生
- 下一篇: 网易裁掉患绝症员工:总有人能替代你工作,