How to determine the distance from the bottom of the page to the top of the document?

Describe the task in more detail.
There is a header, under it div
I want to do: when a user doscroll to the header (the distance between the header and the bottom of the browser nonnegative), then display the div
March 19th 20 at 09:14
1 answer
March 19th 20 at 09:16
it is equal to the distance from the top of the page to the top of the document + the page height.
scrollTop + window.innerHeight

Find more questions by tags jQueryJavaScript