Make menus more mobile friendly
This commit is contained in:
parent
2358eed653
commit
bbb42f52f5
8 changed files with 29 additions and 7 deletions
|
|
@ -161,7 +161,8 @@
|
|||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
&:hover .dropdown-content {
|
||||
&.hoverable:hover .dropdown-content,
|
||||
&.active .dropdown-content {
|
||||
max-height: 100vh;
|
||||
display: block;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -819,7 +819,8 @@ body {
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
.dropdown.item:hover .dropdown-content {
|
||||
.dropdown.item.hoverable:hover .dropdown-content,
|
||||
.dropdown.item.active .dropdown-content {
|
||||
max-height: 100vh;
|
||||
display: block;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -819,7 +819,8 @@ body {
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
.dropdown.item:hover .dropdown-content {
|
||||
.dropdown.item.hoverable:hover .dropdown-content,
|
||||
.dropdown.item.active .dropdown-content {
|
||||
max-height: 100vh;
|
||||
display: block;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -819,7 +819,8 @@ body {
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
.dropdown.item:hover .dropdown-content {
|
||||
.dropdown.item.hoverable:hover .dropdown-content,
|
||||
.dropdown.item.active .dropdown-content {
|
||||
max-height: 100vh;
|
||||
display: block;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -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