Home
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"> </script> <style> .redDiv { background-color: red; height: 100px; width: 100px; } </style> <script> $(document).ready(function () { $('#myDiv').animate({ height: '200px', width: '200px' }, { // options parameter duration: 5000, complete: function () { $(this).animate({ height: '100px', width: '100px' }, 5000, function () { $('#msgDiv').text('Animation completed..'); }); }, start: function () { $('#msgDiv').append('starting animation..'); } }); }); </script> </head> <body> <h1>Demo: jQuery animate() method</h1> <div id="msgDiv"></div> <div id="myDiv" class="redDiv"> </div> </body> </html>
Result: