If you use IntersectionObservers, the callback is only invoked when the observed element comes into view. The beauty of the IntersectionObservers is that it doesn’t matter how the element comes into view. It can be by any kind of scrolling, window resize, or even by changing the visibility of it. It’s very elegant and much more performant than listening to scroll events.
> On Apr 26, 2023, at 12:32 PM, Hugo Ferreira <hferreira...@gmail.com> wrote: > > But, don't forget that the user can grab the scroll bar and drop somewhere.