IntersectionObserver is an API for determining whether an element intersects a viewport.
Here’s an explainer for it. https://github.com/slightlyoff/IntersectionObserver/blob/master/explainer.md
That github repo also has a fairly developed spec. We discussed this with representatives from Apple, Opera, Microsoft and Mozilla in Paris in August and have incorporated their feedback from Paris and followup feedback submitted via the issue tracker. See also the list of open issues that are resolved, but haven’t made it into the spec yet (label:“needs spec”).
For reference, here’s the Blink Intent to Implement thread: https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/eLxh8xUp3j4/m7RH4_nLBgAJ