Prev Demo
jQuery
>
.Stop() - Stop Animation
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> </head> <body> <input type="button" id="btnStart" value="Start" /> <input type="button" id="btnStop" value="Stop" /> <div id="divStop" style="height: 50px; width: 50px; background: brown; left: 300px;position: absolute; display:none ;"></div> <script> $("#btnStart").click(function () { $("#divStop").show("slow"); // 1st animation $("#divStop").animate({ width: '+=200px' }, 2000); // 2nd animation $("#divStop").animate({ width: '-=200px' }, 1500); // 3rd animation }); $("#btnStop").click(function () { $("#divStop").stop(); }); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output