Animate an element, by changing its height and width using jquery
HTML Code :
<!DOCTYPE html> <html> <head> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <meta charset="utf-8"> <title>Animate an element, by changing its height and width</title> </head> <body> <button id="btn1">Animate height & width</button> <button id="btn2">Reset</button> <div id="box" style="background:#B45F04;height:100px;width:100px;margin:6px;"></div> </body> </html>
JavaScript Code :
$( "#btn1" ).click(function() { $( "#box" ).animate({ width: "300px", height: "300px", }, 1500 ); }); $( "#btn2" ).click(function() { $( "#box" ).animate({ width: "100px", height: "100px", }, 1500 ); });
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 :
JavaScript Code :