To get and set the current web page scroll position with JavaScript, we set the scrollTop
property.
For instance, we write
document.documentElement.scrollTop = document.body.scrollTop = 1000;
to set the scrollTop
property of the body element to 1000 to scroll 1000px down.