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

  • جي كويري

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 );
});
هل كان المحتوى مفيد؟

معلومات ذات صلة

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...