Make menus more mobile friendly

This commit is contained in:
oitsjustjose 2020-03-09 08:35:55 -05:00
commit bbb42f52f5
8 changed files with 29 additions and 7 deletions

View file

@ -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");
}
});
});
});