//
sign in
Post
by @danabra.mov
PostEmbed
by @danabra.mov
Record
by @jimpick.com
Record
by @atsui.org
+ new component
Post
⚓️ New Article: How to detect when an element's visibility changes with JavaScript
2d
Today, I wanted to show you how to detect when an element’s visibility changes using the JavaScript IntersectionObserver API. Let’s dig in! The Use Case I was recently working on a Web Component that calculates how much of the viewport it occupies, and automatically resizes itself to make sure it never overflows. As a standalone component, it worked fine. But in real-world use, it was nested inside Kelp’s toggle tabs component.
gomakethings.com
How to detect when an element's visibility changes with JavaScript
Chris Ferdinandi