jquery 11 이미지크기를 픽셀 종류별로 변경
프론트엔드/Jquery2021. 3. 18. 00:22
버튼을 누르면 그림의 크기가 바뀝니다.

<!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.b1").click(function(){
$("img").animate( {
width: '100px'
});
})
$("button.b2").click(function(){
$("img").animate( {
width: '200px'
});
})
$("button.b3").click(function(){
$("img").animate( {
width: '300px'
});
})
});
</script>
<style>
.css_pic{
height: 430px;
text-align: center;
}
.css_pic img{
width:250px;
}
</style>
</head>
<body>
<div class="css_pic">
<p>버튼을 누르면 그림의 크기가 바뀝니다.</p>
<button class="b1">가로 100픽셀</button>
<button class="b2">가로 200픽셀</button>
<button class="b3">가로 300픽셀</button><br></br>
<img name="pic1" src="http://t1.daumcdn.net/friends/prod/editor/dc8b3d02-a15a-4afa-a88b-989cf2a50476.jpg"/>
</div>
</body>
</html>
'프론트엔드 > Jquery' 카테고리의 다른 글
Jquery 13 제이쿼리란? (0) | 2021.04.11 |
---|---|
jquery 12 이미지 위치와 크기를 변경 (0) | 2021.03.18 |
jquery 10 박스를 클릭하면 박스 크기와 색상이 변경 (0) | 2021.03.18 |
jquery 09 css() 메소드 (0) | 2021.03.18 |
jquery 07 addClass()와 removeClass()메소드 (0) | 2021.03.18 |
댓글()