-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
43 lines (40 loc) · 1.56 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
let dropdowns = document.querySelectorAll(".dropdown");
let i;
for (i = 0; i < dropdowns.length; i++) {
dropdowns[i].addEventListener("click", function (event) {
this.classList.toggle("active");
let content = this.nextElementSibling;
console.log("before: " + content.style.display);
if (content.style.padding !== "0px var(--spacing-sizing-6") {
content.style.padding = "0px var(--spacing-sizing-6";
} else {
content.style.padding = "0 var(--spacing-sizing-6) var(--spacing-sizing-4) var(--spacing-sizing-6)";
}
console.log("after: " + content.style.display);
if (content.style.maxHeight != "0px") {
content.style.maxHeight = "0px";
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});
}
let show_passing_btn = document.querySelector("#show_passing_btn");
show_passing_btn.addEventListener("click", function (event) {
this.classList.toggle("show_passing_btn_active");
if (this.textContent === "Show") {
this.textContent = "Hide";
} else {
this.textContent = "Show";
}
let content = document.querySelector("#passing_cards");
if (content.style.overflow === "visible" || !content.style.overflow) {
content.style.overflow = "hidden";
} else {
content.style.overflow = "visible";
}
if (content.style.maxHeight != "0px" || !content.style.maxHeight) {
content.style.maxHeight = "0px";
} else {
content.style.maxHeight = content.scrollHeight + "px";
}
});