Refactor variable names
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
const SCROLL_MIN = 100;
|
||||
scroll_to_top = document.getElementById("scroll-to-top");
|
||||
el_drawer = document.getElementById("drawer");
|
||||
el_container = document.getElementById("container");
|
||||
$drawer_item = document.querySelectorAll(".drawer-item");
|
||||
const $scroll_to_top = document.getElementById("scroll-to-top");
|
||||
const $drawer = document.getElementById("drawer");
|
||||
const $drawer_item = document.querySelectorAll(".drawer-item");
|
||||
|
||||
function checkScroll() {
|
||||
if (document.documentElement.scrollTop > SCROLL_MIN || document.body.scrollTop > SCROLL_MIN) {
|
||||
scroll_to_top.style.visibility = "visible";
|
||||
$scroll_to_top.style.visibility = "visible";
|
||||
} else {
|
||||
scroll_to_top.style.visibility = "hidden";
|
||||
$scroll_to_top.style.visibility = "hidden";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +21,14 @@ async function sleep(milliseconds) {
|
||||
}
|
||||
|
||||
async function toggleDropdown() {
|
||||
let expanded = el_drawer.classList.contains("expanded");
|
||||
let expanded = $drawer.classList.contains("expanded");
|
||||
if (expanded) {
|
||||
for (let i = 0; i < $drawer_item.length; i++) {
|
||||
$drawer_item[i].classList.toggle("visible");
|
||||
}
|
||||
el_drawer.classList.toggle("expanded");
|
||||
$drawer.classList.toggle("expanded");
|
||||
} else {
|
||||
el_drawer.classList.toggle("expanded");
|
||||
$drawer.classList.toggle("expanded");
|
||||
await sleep(250);
|
||||
for (let i = 0; i < $drawer_item.length; i++) {
|
||||
$drawer_item[i].classList.toggle("visible");
|
||||
|
||||
Reference in New Issue
Block a user