Scrolling value of elements in JavaScript

The following properties contain how much the element is scrolled:

console.log(elem.scrollTop); // from top console.log(elem.scrollLeft); // from left

The following example shows how these properties work. Scroll the element and click on the button, you will see the scroll amount:

Given an element and a button. By clicking on the button, find out how much the element is scrolled vertically.

Given an element and a button. On button click, check if the element is scrolled vertically.

Scroll to the bottom of the element. Press the button to display the full scroll value.

Get the element's scrollHeight and subtract the full scroll amount (take it from the previous task) from it. What will be the value? What dimensions does it contain?

Add offsetHeight and the amount of full scroll. Subtract this amount from scrollHeight. What number will come out?

enru