Q:

Animate an element, by changing its height and width using jquery

0

Animate an element, by changing its height and width using jquery

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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 );
});

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now