new design with nice layout
This commit is contained in:
+21
-1
@@ -1 +1,21 @@
|
||||
//
|
||||
const mobileMenu = document.querySelector('.site-menu');
|
||||
|
||||
if (mobileMenu) {
|
||||
const menuButton = mobileMenu.querySelector('summary');
|
||||
|
||||
mobileMenu.querySelectorAll('nav a').forEach((link) => {
|
||||
link.addEventListener('click', () => {
|
||||
mobileMenu.open = false;
|
||||
if (link.pathname === window.location.pathname && link.hash) {
|
||||
menuButton.focus({ preventScroll: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
mobileMenu.addEventListener('keydown', (event) => {
|
||||
if (event.key === 'Escape' && mobileMenu.open) {
|
||||
mobileMenu.open = false;
|
||||
menuButton.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user