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,12 +132,14 @@ const publicDemoSite = isEnabled((globalThis as any).process?.env?.PUBLIC_DEMO_S
|
||||||
setNavOpen(!nav.classList.contains('is-open'));
|
setNavOpen(!nav.classList.contains('is-open'));
|
||||||
});
|
});
|
||||||
|
|
||||||
nav.querySelectorAll('a').forEach((link) => {
|
nav.addEventListener('click', (event) => {
|
||||||
link.addEventListener('click', () => {
|
const target = event.target;
|
||||||
if (window.matchMedia('(max-width: 640px)').matches) {
|
if (!(target instanceof HTMLElement)) return;
|
||||||
setNavOpen(false);
|
if (target.closest('#nav-toggle')) return;
|
||||||
}
|
if (!target.closest('a')) return;
|
||||||
});
|
if (window.matchMedia('(max-width: 640px)').matches) {
|
||||||
|
setNavOpen(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue