jquery 12 이미지 위치와 크기를 변경

프론트엔드/Jquery|2021. 3. 18. 00:25
Document

<!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">
  <title>Document</title>
  <script src="jquery-3.6.0.min.js"></script>
  <script>
    $(document).ready(function(){
      $("button.move").click(function(){
        $("img").animate( {
          left: '300px',
          height: '300px',
          width: '350px'
        });        
      });
      $("button.init").click(function(){
        $("img").animate( {
          left: '0px',
          height: '100px',
          width: '130px'
        });        
      });
      });    
  </script> 
</head>
<body> 
    <button class="move">확대</button>
    <button class="init">축소</button>
    <p></p>
    <img name="pic1" src="https://t1.daumcdn.net/friends/prod/editor/dc8b3d02-a15a-4afa-a88b-989cf2a50476.jpg" width="130" height="100" style="position:relative"/>
</body>
</html>

댓글()
구독