<!DOCTYPE html>
<html lang="en-US">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <style>
div{
width: 100px;
height: 100px;
background: #f69d3c;
margin-bottom: 10px;
line-height: 6;
text-align: center;
}
</style>
</head>
<body>
<h1>jQuery animate() Method</h1>
<div>Div</div>
<button id="myAnimate">Animate</button>
<button id="myStop">Stop</button>
<script>
$(document).ready(function(){
$("#myAnimate").click(function(){
$("div").animate({width: 200}, 2000);
});
$("#myStop").click(function(){
$("div").stop();
});
});
</script> </body>
</html>