Phương thức jQuery delay ()

❮ Phương thức hiệu ứng jQuery

Thí dụ

Trì hoãn các phần tử <div> khác nhau:

$("button").click(function(){
  $("#div1").delay("slow").fadeIn();
  $("#div2").delay("fast").fadeIn();
});

Định nghĩa và Cách sử dụng

Phương thức delay () đặt bộ đếm thời gian để trì hoãn việc thực thi mục tiếp theo trong hàng đợi.


Cú pháp

$(selector).delay(speed,queueName)

Parameter Description
speed Optional. Specifies the speed of the delay

Possible values:

  • milliseconds
  • "slow"
  • "fast"
queueName Optional. Specifies the name of the queue

Default is "fx", the standard effects queue

Hãy tự mình thử - Ví dụ


Cách trì hoãn một hoạt ảnh.


❮ Phương thức hiệu ứng jQuery