How to correctly determine the point when scrolling the page?
Good afternoon, the essence of the task is this: I need to perform a specific action when the scroll reaches a certain point on the page (this is the top point of block 2 in the example). In essence, it will be just a sticky button that is fixed from the top of the page to the footer, and at the border with the footer should stay in place.
So: why is my scroll value almost always less than the offset of my block? If only the page window itself is made small in height, then the value of the scroll will be larger than my breakpoint.
How to correctly identify this point?
p.s position sticky is not suitable, well, it is not needed here.
To place the code, please use CodePen or similar tool. Thanks you!