Sync: implement menu toggle functionality to manage body overflow state

This commit is contained in:
Matt Batchelder
2026-02-21 17:06:47 -05:00
parent 8f43b6c584
commit 21d41b24d8
2 changed files with 5 additions and 0 deletions

View File

@@ -493,6 +493,10 @@ p:last-child { margin-bottom: 0; }
z-index: 99;
padding: 5rem 2rem 2rem;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
body.menu-open {
overflow: hidden;
}
.site-nav.open .nav-menu {
flex-direction: column;

View File

@@ -39,6 +39,7 @@ document.addEventListener('DOMContentLoaded', () => {
toggle.addEventListener('click', () => {
toggle.classList.toggle('open');
nav.classList.toggle('open');
document.body.classList.toggle('menu-open');
const expanded = toggle.getAttribute('aria-expanded') === 'true';
toggle.setAttribute('aria-expanded', !expanded);
});