delay method in jquery

It sets the Timer, it sets the duration, which is the number of milliseconds to delay execution of the next item in the queue.


<!DOCTYPE html>
<html>
<head>
  <style>
div { position: absolute; width: 60px; height: 60px; float: left; }
.one { background-color: Pink; left: 0;}
.two { background-color: Green; left: 50px;}
</style>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
  
<p><button>Clck Me!!!</button></p>
<div class="one"></div>
<div class="two"></div>
        
<script>
    $("button").click(function() {
      $("div.one").slideUp(200).delay(500).fadeIn(1000);
      $("div.two").slideUp(200).fadeIn(500);
    });
</script>

</body>
</html>



Output:


1.png

Next Recommended Reading prepend method in jquery