JQuery animate()

2020/JQuery 2020. 3. 1. 22:09
반응형
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script>
      //(selector).animate({styles}, speed,  easing, callback)
      $(document).ready(function() {
        $("#btn1").click(function() {
          $("#box").animate({ height: "300px" });
        });
        $("#btn2").click(function() {
          $("#box").animate({ height: "100px" }, 3000);
        });
      });
    </script>
    <title>Document</title>
  </head>
  <body>
    <button id="btn1">Animate height</button>
    <button id="btn2">Reset height</button>

    <div
      id="box"
      style="background:#98bf21;height:100px;width:100px;margin:15px;"
    ></div>
  </body>
</html>
반응형

'2020 > JQuery' 카테고리의 다른 글

JQuery eq, last, first()  (0) 2020.03.02
JQuery 배열관리  (0) 2020.03.01
JQuery FadeIn(), FadeOut()  (0) 2020.03.01
Jquery slideDown(), slideUp()  (0) 2020.03.01
JQuery on, off(이벤트 연결 및 제거)  (0) 2020.02.29
블로그 이미지

꽃꽂이하는개발자

,