mirror of
https://codeberg.org/likwid/likwid.git
synced 2026-02-09 21:13:09 +00:00
ui: close mobile nav after auth inject
This commit is contained in:
parent
0ee3fe6d21
commit
589f9f4987
1 changed files with 8 additions and 6 deletions
|
|
@ -132,13 +132,15 @@ const publicDemoSite = isEnabled((globalThis as any).process?.env?.PUBLIC_DEMO_S
|
|||
setNavOpen(!nav.classList.contains('is-open'));
|
||||
});
|
||||
|
||||
nav.querySelectorAll('a').forEach((link) => {
|
||||
link.addEventListener('click', () => {
|
||||
nav.addEventListener('click', (event) => {
|
||||
const target = event.target;
|
||||
if (!(target instanceof HTMLElement)) return;
|
||||
if (target.closest('#nav-toggle')) return;
|
||||
if (!target.closest('a')) return;
|
||||
if (window.matchMedia('(max-width: 640px)').matches) {
|
||||
setNavOpen(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
if (window.innerWidth > 640) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue