Observing multiple elements with one IntersectionObserver

This is an example of using the IntersectionObserver API to observe more than one element. Both videos may play at the same time if the viewport can accommodate them both. A saner, less cacophonous example would pause other videos.

Time lapse of moving stars video by Erhan Dayı. Music by striptheband.

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