Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- console.log(to)
- let x = 0
- let y = 0
- let el
- let elTop
- let isSamePageLink = to.hash.length && to.hash.match(/#\/[A-z0-9]/) === null
- if (isSamePageLink) {
- el = document.getElementByID(to.hash)
- elTop = el ? el.offsetTop : 0
- window.scrollTo(0, elTop)
- console.log('internal scroll')
- } else {
- window.scrollTo(x, y)
- console.log('normal route change')
- }
Add Comment
Please, Sign In to add comment