End a custom queue function using dequeue which allows the queue to keep going using jquery
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 ); });
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
HTML Code :
CSS Code :
JavaScript Code :