English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery effect delay() method

jQuery Effect Methods

The delay() method sets a timer to delay the execution of subsequent items in the queue.

Syntax:

$(selector).delay(duration, queueName)

Example

Set different speed values for the delay() method:

$("button").click(function(){
  $("#div1'.delay('slow').fadeIn();
  $("#div2'.delay('fast').fadeIn();
  $("#div3'.delay(',1000).fadeIn();
  $("#div4'.delay(',2000).fadeIn();
  $("#div5'.delay(',3000).fadeIn();
});
Test See‹/›

Animate the up and down sliding of two divs, and then show " div1Delay before showing "

$("button").click(function(){
  $("#div1).slideUp(300).delay(800).slideDown(400);
  $("#div2).slideUp(300).slideDown(400);
});
Test See‹/›

Using delay() and animate() at the same time:

$("button").click(function(){
  $("div").animate({width: "500px"});
  $("div").delay(1000).animate({fontSize: "5em"});
});
Test See‹/›

Parameter Value

ParameterDescription
duration(Optional) Specify the number of milliseconds to delay the execution of the next item in the queue

Possible Values:

  • milliseconds (e.g.,100,500,2(e.g., 000)

  • "fast"

  • "slow"

queueName(Optional) Specify the name of the queue. The default isfxStandard Effect Queue

jQuery Effect Methods