-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
46 lines (45 loc) · 1.58 KB
/
index.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
35
36
37
38
39
40
41
42
43
44
45
46
document.addEventListener("DOMContentLoaded", function () {
const bar = document.getElementById("sidebar");
const helpMenuItems = document.getElementById("cats");
const helpMenu = document.getElementById("help-menu");
const helpCaret = document.getElementById("caret");
let helpOpen = false;
document.addEventListener("click", function () {
bar.classList.remove("movingbar");
});
document.addEventListener("mousemove", function (event) {
if (event.clientX <= 5 && bar.classList.contains("movingbar") !== true) {
bar.classList.add("movingbar");
}
});
document.addEventListener("click", (e) => {
if (!e.target.classList.contains("help-menu")) {
helpMenuItems.style.transform = "scaleY(0)";
helpMenu.removeAttribute("style");
helpCaret.removeAttribute("style");
helpOpen = false;
}
});
helpMenu.addEventListener("click", () => {
if (helpOpen === false) {
helpMenuItems.style.transform = "scaleY(1)";
helpMenu.style.backgroundColor = "rgba(15, 15, 15, 0.8)";
helpCaret.style.transform = "rotate(0deg)";
helpOpen = true;
} else {
helpMenuItems.style.transform = "scaleY(0)";
helpMenu.removeAttribute("style");
helpCaret.removeAttribute("style");
helpOpen = false;
}
});
});
document.addEventListener("DOMContentLoaded", function () {
let updateModal = document.querySelector(".modal-background");
document.addEventListener("click", (e) => {
if (e.target === updateModal) {
e.target.style.display = "none";
localStorage.setItem("macideasmodal", "true");
}
});
});