Skip to content

Commit 4cb13da

Browse files
committed
fix: chrome android nav scroll
Fixes #14
1 parent c641fcd commit 4cb13da

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

out/mobile-menu.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
document.querySelectorAll("nav img, nav a").forEach(e => {
22
e.addEventListener("click", () => {
3-
document.querySelector("nav").classList.toggle("visible");
4-
document.querySelector("nav").scrollTo({ top: 0, behavior: "smooth" }); // Reset scroll position
3+
const navElement = document.querySelector("nav");
4+
navElement.classList.toggle("visible");
5+
setTimeout(() => {
6+
navElement.scrollTo({ top: 0, behavior: "smooth" }); // Reset scroll position
7+
}, 0);
58
})
69
});
710

0 commit comments

Comments
 (0)