-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
48 lines (46 loc) · 1.25 KB
/
index.html
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Heart Beat</title>
<script type="text/javascript">
var width=100;
var difference =2;
var intervalID= 0;
function increase(){
clearInterval(intervalID);
intervalID = setInterval(zoomIn,20);
}
function decrease(){
clearInterval(intervalID);
intervalID = setInterval(zoomOut,20);
}
function zoomIn(){
if(width<200){
width = width+difference;
document.getElementById('img1').width = width;
console.log(width);
}
else{
clearInterval(intervalID);
}
}
function zoomOut(){
if(width>100){
width = width-difference;
document.getElementById('img1').width = width;
}
else{
clearInterval(intervalID);
}
}
</script>
</head>
<body>
<br>
<h1>Just take your cursor above the heart</h1>
<br>
<img onmouseover="increase()" onmouseout="decrease()" id="img1" src="heart.png" width="100">
</body>
</html>