-
Notifications
You must be signed in to change notification settings - Fork 0
/
openner.js
34 lines (30 loc) · 954 Bytes
/
openner.js
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
const btnOpen = document.getElementById("open-message");
const body = document.querySelector("body");
const openner = document.querySelector("#openner");
const receiver = document.querySelector("#receiver");
const music = document.querySelector("audio");
const musicIcon = document.querySelector(".music-icon");
musicIcon.addEventListener("click", () => {
if (musicIcon.classList.contains("disabled")) {
musicIcon.classList.remove("disabled");
music.play();
} else {
musicIcon.classList.add("disabled");
music.pause();
}
});
let params = new URLSearchParams(location.search);
let name = params.get("to");
if (name) {
receiver.innerText = name;
} else {
receiver.innerText = "";
}
btnOpen.addEventListener("click", () => {
body.classList.remove("overflow-hidden");
setTimeout(() => {
openner.remove();
}, 500);
openner.style.transform = "translateY(-100vh)";
music.play();
});