Effect delay() Method - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:delay

Description

The delay() method sets a timer to delay the execution of effect queue.

Syntax

Parameter RequireDescription Value
speed Optional.speed of the delay. Possible values: milliseconds "slow" "fast"
queueName Optional. name of the queue. Default is "fx", the standard effects queue

The following code shows how to Delay different <div> elements:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("#btn1").click(function(){
        $("div").animate({height: "150px"});
        $("div").animate({width: "150px"});
        $("div").delay(1200).animate({height: "300px"});
    });/*from w  w w.  j a  va 2  s . com*/
});
</script>
</head>
<body>

<div style="background:purple;height:75px;width:75px;margin:6px;"></div>

<p><button id="btn1">Animate</button></p>

</body>
</html>

Related Tutorials