Skip to content

Commit

Permalink
Update menu overlay for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrturner committed Feb 25, 2024
1 parent 576441d commit 211d0f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assets/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,13 @@ menu overlay
justify-content: end;
align-items: end;
}
@media (max-width: 768px) {
.overlay {
align-items: center;
justify-content: flex-start;
}
}

.overlay,
.overlay * {
pointer-events: none !important;
Expand Down
6 changes: 6 additions & 0 deletions assets/js/menu-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,11 @@ document.addEventListener("DOMContentLoaded", function () {
overlay.style.opacity = isOpen ? "0" : "1";
overlay.style.visibility = isOpen ? "hidden" : "visible";
menu.classList.toggle("hidden");
// toggle body scroll
if (isOpen) {
document.body.style.overflowY = "scroll";
} else {
document.body.style.overflowY = "hidden";
}
});
});

0 comments on commit 211d0f8

Please sign in to comment.