IntersectionObserver’s Coming into View  |  Web  |  Google Developers

IntersectionObservers let you know when an observed element enters or exits the browser’s viewport.