Sync: implement menu toggle functionality to manage body overflow state
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user