Merge pull request #1384 from docsifyjs/fix/1383

Fix scroll event end value
This commit is contained in:
John Hildenbiddle 2020-10-05 14:27:03 -05:00 committed by GitHub
commit 474266051c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,8 @@ function scrollTo(el, offset = 0) {
enableScrollEvent = false;
scroller = new Tweezer({
start: window.pageYOffset,
end: el.getBoundingClientRect().top + window.pageYOffset - offset,
end:
Math.round(el.getBoundingClientRect().top) + window.pageYOffset - offset,
duration: 500,
})
.on('tick', v => window.scrollTo(0, v))