[jQuery] animate()

2021. 11. 29. 11:17HTML&CSS&JavaScript/jQuery

반응형

 

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script
      type="text/javascript"
      src="http://code.jquery.com/jquery-latest.min.js"
    ></script>

    <title>Document</title>
  </head>
  <body>
    <img
      src="./image/dinos.jpeg"
      alt="공룡"
      id="dog"
      width="1000"
      height="500"
      style="position: relative"
      <!--
      position이
      static이면
      이동이
      되지
      않는다.
      --
    />
    />
    <br />
    <button>animate()</button>
    <script>
      $(document).ready(function () {
        $("button").click(function () {
          $("#dog").animate({ left: "500px" }, "slow");
        });
      });
    </script>
  </body>
</html>
반응형

'HTML&CSS&JavaScript > jQuery' 카테고리의 다른 글

[jQuery] Ajax  (0) 2021.11.30
[jQuery] jQuery를 이용한 DOM 변경  (0) 2021.11.29
[jQuery] fadeIn()/fadeOut()  (0) 2021.11.29
[jQuery] toggle()  (0) 2021.11.29