본문 바로가기

콩's EDUCATION/콩's Javascript

jquery animate


<!DOCTYPE HTML >

<html>

 <head>

  <meta charset="utf-8">

  <title>jquery</title>

  <style>

   div {background:#98bf21;height:100px;width:100px}

  </style>

  <script src="http://code.jquery.com/jquery-1.10.1.min.js">

  </script>

  <script type="text/javascript">     

    $(document).ready(function(){

  $("#start").click(function(){

var div = $("div"); 

    div.animate({height:300},"slow");

    div.animate({width:300},"slow");

    div.animate({height:100},"slow");

    div.animate({width:100},"slow");

  });

  $("#stop").click(function(){

 $("div").clearQueue();

  });

});

    </script>


 </head>

 <body>    

 

<p>

<button id="start">Start Animation</button>

<button id="stop">Stop Current Animation</button>

</p>

<div></div>  

 </body>

</html>