aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-11-14 15:40:34 +0100
committerAnhgelus Morhtuuzh <anhgelus.morhtuuzh@proton.me>2024-11-14 15:40:34 +0100
commit964ae2b7f03ebfaac051e9c14e142c178ad16cca (patch)
treef1096c7b27be1107f76a858b039fc0640867de79
parent44173f34c293d011019b84be7095039eac977c5b (diff)
fix(nav): not scrolling to 0 0 if user scrolled
-rw-r--r--index.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/index.ts b/index.ts
index e4b19d6..24951c2 100644
--- a/index.ts
+++ b/index.ts
@@ -28,8 +28,20 @@ function changePage(href: string) {
if (distMain === null || currentMain === null) document.body = doc.body
else currentMain.innerHTML = distMain.innerHTML
setupEvents()
+ scrollTo({
+ top: 0,
+ left: 0,
+ behavior: "smooth"
+ })
})
}
-window.addEventListener("popstate", e => window.location.reload())
+window.addEventListener("popstate", _ => {
+ window.location.reload()
+ scrollTo({
+ top: 0,
+ left: 0,
+ behavior: "smooth"
+ })
+})
setupEvents()