Getting a window scroll in JavaScript
The following (read-only) properties contain how much the window is scrolled:
let x = window.pageXOffset; // from left
let y = window.pageYOffset; // from top
On button click, display how much the window has been scrolled vertically.
On button click, display how much is left until the end of the vertical scrolling.