An introduction to the fundamentals of the Intersection Observer JavaScript API, showing how it watches elements entering and leaving the viewport. It also covers the threshold and rootMargin options and is aimed at people new to the API.
What you’ll learn
✓Explain how Intersection Observer detects elements entering or leaving the viewport
✓Set the threshold and rootMargin options to control when an observer fires
✓Use Intersection Observer in place of scroll event listeners