-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnotify.js
More file actions
29 lines (20 loc) · 768 Bytes
/
notify.js
File metadata and controls
29 lines (20 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const notify = document.querySelector(".notifications");
const closed = notify.querySelector(".fa-x");
let showNotification = (title, message) => {
notify.querySelector(".notifytitle").textContent = title;
notify.querySelector(".notifymsg").textContent = message;
notify.querySelector(".notifyicon").innerHTML = '<i class="fa-solid fa-circle-xmark"></i>';
notify.style.right = "20px";
notify.style.transform = "scale(1)";
notify.classList.add("notify");
const closeNotification = () => {
notify.style.right = "-50%";
notify.style.transform = "scale(0) ";
}
setTimeout(() => {
closeNotification();
}, 5000);
closed.addEventListener("click", () => {
closeNotification();
});
}