Q:

Use dequeue to end a custom queue function which allows the queue to keep going using query

0

Use dequeue to end a custom queue function which allows the queue to keep going using query

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

HTML Code:

<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
  <meta charset="utf-8">
  <title>Use dequeue to end a custom queue function which allows the queue to keep going</title>
<style>
  div {
    margin: 3px;
    width: 50px;
    position: absolute;
    height: 50px;
    left: 10px;
    top: 30px;
    background-color: #9F81F7;
  }
  div.new {
    background-color: #3B0B24;
  }
  </style>  
</head>
<body>
 <button>Start</button>
<div </div>
</body>
</html>

JavaScript Code :

$( "button" ).click(function() {
  $( "div" )
  .animate({ left:"+=250px" }, 2000 )
   .queue(function() {
      $( this ).toggleClass( "new" ).dequeue();
    })
.animate({ left:"-=250px" }, 2000 );
});

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now