From 6ce20820b35a95f87104c445693cfc1aa38f5df0 Mon Sep 17 00:00:00 2001 From: xpf <965732851@qq.com> Date: Fri, 6 Dec 2024 17:33:31 +0800 Subject: [PATCH 1/2] fix: mobilescrolling --- src/components/common/MobileNavbar.astro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/common/MobileNavbar.astro b/src/components/common/MobileNavbar.astro index c1dc2195a9f..ed62b9e2b52 100644 --- a/src/components/common/MobileNavbar.astro +++ b/src/components/common/MobileNavbar.astro @@ -127,6 +127,7 @@ for (let i = 0; i < dataSource.length; i++) { toggleExpanded() { // document.body.classList.toggle('overflow-hidden'); this.setExpanded(this.getAttribute("aria-expanded") !== "true"); + window.scroll(0, 0); } closeOnEscape(e: KeyboardEvent,menuButton) { From eb60f68ebbb43f34a4d983eca6a3e76685de8d56 Mon Sep 17 00:00:00 2001 From: xpf <965732851@qq.com> Date: Fri, 6 Dec 2024 17:37:55 +0800 Subject: [PATCH 2/2] . --- src/components/common/MobileNavbar.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/MobileNavbar.astro b/src/components/common/MobileNavbar.astro index ed62b9e2b52..6ed4ac11c99 100644 --- a/src/components/common/MobileNavbar.astro +++ b/src/components/common/MobileNavbar.astro @@ -127,7 +127,7 @@ for (let i = 0; i < dataSource.length; i++) { toggleExpanded() { // document.body.classList.toggle('overflow-hidden'); this.setExpanded(this.getAttribute("aria-expanded") !== "true"); - window.scroll(0, 0); + try { window.scroll(0, 0); } catch(err) {} } closeOnEscape(e: KeyboardEvent,menuButton) {