The Intersection Observer API is a JavaScript API that allows you to observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport.