-
Notifications
You must be signed in to change notification settings - Fork 0
/
yipee.html
81 lines (73 loc) · 2.09 KB
/
yipee.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Yipee!</title>
<link rel="stylesheet" href="css/global.css">
<style>
.yipee {
position: absolute;
top: 20vh;
animation-name: move;
animation-duration: 2.2s;
animation-timing-function: ease-in-out;
animation-iteration-count: 1;
}
@keyframes move {
from {
left: 0vw;
}
to {
left: 60vw;
}
}
@media (max-width: 1250px) {
@keyframes move {
from {
left: 0vw;
}
to {
left: 0vw;
}
}
}
#btn-container {
display: flex;
height: 100vh;
flex-direction: column;
justify-content: flex-end;
align-items: center;
}
#btn {
width: fit-content;
margin-bottom: 10rem;
font-size: 2rem;
}
</style>
<script>
var counter = 0;
document.addEventListener("DOMContentLoaded", () => {
let btn = document.getElementById('btn');
btn.addEventListener("click", () => {
btn.insertAdjacentHTML("afterend", `
<img class="yipee" style="left: 0vw" id="yippee-${counter}"src="./images/yipee/yipee-${counter % 20}.gif"></img>
`);
setTimeout(() => {
let sound = new Audio('./images/yipee/yippee.mp3');
sound.play();
}, 300);
const curr_val = counter;
setTimeout(() => {
document.getElementById(`yippee-${curr_val}`).remove();
}, 2200);
counter++;
});
});
</script>
<body>
<div id="btn-container">
<button id="btn">Click me</button>
</div>
</body>
</html>