Make menus more mobile friendly
This commit is contained in:
parent
2358eed653
commit
bbb42f52f5
8 changed files with 29 additions and 7 deletions
|
|
@ -60,4 +60,22 @@ window.addEventListener("DOMContentLoaded", (evt) => {
|
|||
el.parentElement.insertBefore(child, el.nextSibling);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Add .active to clicked on menus
|
||||
document.querySelectorAll(".dropdown.item").forEach((dropdown) => {
|
||||
dropdown.addEventListener("click", () => {
|
||||
if (dropdown.classList.contains("active")) {
|
||||
dropdown.classList.remove("active");
|
||||
} else {
|
||||
dropdown.classList.add("active");
|
||||
}
|
||||
});
|
||||
|
||||
dropdown.addEventListener("mouseout", () => {
|
||||
if (dropdown.classList.contains("active")) {
|
||||
dropdown.classList.remove("active");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue