smooth article scrolling

This commit is contained in:
Nazar Kanaev 2021-03-18 12:03:02 +00:00
parent 4924dcfd12
commit 54cb821ae9

View File

@ -80,8 +80,13 @@ var helperFunctions = {
if (!scroll) return
var height = scroll.getBoundingClientRect().height
var newpos = scroll.scrollTop + (height - padding) * direction
scroll.scrollTop += (height - padding) * direction
if (typeof scroll.scrollTo == 'function') {
scroll.scrollTo({top: newpos, left: 0, behavior: 'smooth'})
} else {
scroll.scrollTop = newpos
}
}
}
var shortcutFunctions = {