Using IntersectionObserver with video and an intersection root

In this example, we've set the root option on the IntersectionObserver constructor.

I've also added a border to the intersection root so that you understand its bounds.

const options = {root: document.querySelector('#observer-root') };
const videoObserver = new IntersectionObserver(callback, options)

Video track by Tiffany B. Brown (that's me!), © 2023. I recorded it in May of 2023 while riding the Teleféric del Port facing Montjüic heading towards Barceloneta.

Audio track: "Doctor Dreamchip - Lofi Keyboard Pack - Rhodes80BPM C Major - 12.wav" by Doctor_Dreamchip is licensed under CC BY 4.0 .

Back to the post