Hi! I'm trying to figure out the best way to detect when an element scrolls into view. Specifically, I server render a list of items that is long and expands beyond the viewport. I'd like to run a function when each item scrolls into view. I was trying to implement the Intersection Observer API but couldn't figure out how to make Astro happy between server rendering my list of components and running the script on the browser. I know some Astro things might use the Intersection Observer API under the hood, so maybe there is a built-in method? Thanks!
#Best way to detect if an element is visible in viewport?
2 messages · Page 1 of 1 (latest)