This article demonstrates using the Javascript Intersection Observer API, instead of measuring scroll position, to perform common visibility detection tasks. The Problem In Javascript, performing an action when an element becomes visible to a user has previously always required the following: Detecting the current scroll position. Setting an event listener to do…