<!DOCTYPE html>
<html>
<head>
<title>jQuery animate() method</title>
<script src="jquery-latest.min.js"></script>
<script>
$(document).ready(function() {
$("#btnstart").click(function(){
var $box = $("#animatebox");
$box.animate({height: "300px"});
$box.animate({width: "300px"});
$box.animate({opacity: 0.5});
$box.animate({marginLeft: "100px"});
$box.animate({borderWidth: "10px"});
$box.animate({fontSize: "40px"});
});
$("#btnstop").click(function(){
var $box = $("#animatebox");
$box.animate({fontSize: "15px"});
$box.animate({height: "100px"});
$box.animate({width: "100px"});
$box.animate({opacity: 1});
$box.animate({marginLeft: "10px"});
$box.animate({borderWidth: "5px"});
});
});
</script>
<style type="text/css">
#animatebox {
width: 100px;
height: 100px;
background: #FC5E5E;
margin-left: 10px;
border-color: #de2d2d;
border-style: solid;
border-width: 5px;
font-size: 15px;
}
</style>
</head>
<body>
<button id="btnstart">Start Animation</button>
<button id="btnstop">Restore Animation</button>
<br /><br />
<div id="animatebox">jQuery Animate</div>
</body>
</html>