Skip to content

Commit 153555b

Browse files
committed
Fix anchor scroll positions on page load
This fixes btcpayserver#614, which seems to be caused by vuejs/vuepress#2428.
1 parent a78cd06 commit 153555b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/.vuepress/enhanceApp.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ export default ({ router }) => {
8181
})
8282
}
8383
}, 250)
84+
85+
// temporary fix for https://github.com/vuejs/vuepress/issues/2428
86+
setTimeout(() => {
87+
const { hash } = document.location
88+
if (hash.length > 1) {
89+
const id = hash.substring(1)
90+
const element = document.getElementById(id)
91+
if (element) element.scrollIntoView()
92+
}
93+
}, 500)
8494
})
8595

8696
document.addEventListener('click', handleClick)

0 commit comments

Comments
 (0)