jargon

Frontend & browser·Storage and platform APIs

you found out when the element scrolled into view without running any code on scroll.

IntersectionObserver

Also calledintersection observer, visibility observer

An API that reports asynchronously when an element enters or leaves a viewport or ancestor, off the main thread's scroll path. It replaced the pattern of measuring positions in a scroll handler, which caused forced layout on every frame. Its callback is throttled and batched, so it is for triggering work rather than for driving a scroll-linked animation.

Commonly confused with