-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice9-6.html
More file actions
32 lines (31 loc) · 1.06 KB
/
practice9-6.html
File metadata and controls
32 lines (31 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>onwheel</title>
<script>
function wheel(e){
let s=1;
let img=document.getElementById("img");
if(e.wheelDelta > 0){
s+=0.05;
document.getElementById("img").style.width = img.width*s+"px";
document.getElementById("img").style.height = img.height*s+"px";
}
else if(e.wheelDelta<0){
s-=0.05;
document.getElementById("img").style.width = img.width*s+"px";
document.getElementById("img").style.height = img.height*s+"px";
}
}
</script>
</head>
<body>
<h2>마우스 휠을 이용한 이미지 확대/축소</h2>
<hr>
<p>이미지 위에 휠을 위로 굴리면 이미지가 축소되고 아래로 굴리면 이미지가 확대 됩니다.</p>
<br>
<img id="img" src="./images/mango.jpg" onwheel="wheel(event)">
</body>
</html>