fix(nav): not scrolling to 0 0 if user scrolled
This commit is contained in:
parent
44173f34c2
commit
964ae2b7f0
1 changed files with 13 additions and 1 deletions
14
index.ts
14
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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue