Q:

End a custom queue function using dequeue which allows the queue to keep going using jquery

0

End a custom queue function using dequeue which allows the queue to keep going using jquery

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="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>End a custom queue function using dequeue which allows the queue to keep going.</title>
</head>
<body>
<button>Start</button>
<div></div>
</body>
</html>

CSS Code :

div {
margin: 25px;
width: 40px;
position: absolute;
height: 40px;
left: 10px;
top: 40px;
background-color: green;
}
div.red {
background-color: red;
}

JavaScript Code :

$( "button" ).click(function() {
$( "div" )
.animate({ left:"+=200px" }, 1500 )    .animate({ top:"0px" }, 400 )
.queue(function() {
$( this ).toggleClass( "red" ).dequeue();
})
.animate({ left:"10px", top:"30px" }, 400 );
});

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