-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
21 lines (21 loc) · 743 Bytes
/
index.html
File metadata and controls
21 lines (21 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div style="width: 100%; height:100vh; display: flex;">
<img src="images/drink.jpg" id="img" style="width: 200px;height: 200px; display:block; margin:auto;">
</div>
<script>
const img = document.getElementById('img')
let i = 100;
setInterval(()=>{
if(parseFloat(img.style.width) > 1300 || parseFloat(img.style.height) > 1300) i *=-1
if(parseFloat(img.style.width) < 100 || parseFloat(img.style.height) < 100) i *=-1
img.style.width = `${parseFloat(img.style.width) + (i)}`+'px';
img.style.height = `${parseFloat(img.style.height) + (i)}`+'px';
},100)
</script>
</body>
</html>