I think nowadays you'd better use IntersectionObserver for that: developer.mozilla.org/en-US/docs/W...
Woah, this looks amazing! Admittedly there's no IE support but still, this looks like a much more performant way of checking scroll position. Thanks for the link!
Update: Added a note to the beginning of this post
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.