0

Autoplay video when scroll

Hello, on my page I need a video to automatically play when the viewer goes through it when scrolling on the page. So my question is what codes can be used to generate that function?

11th May 2020, 12:39 AM
Esteban Arango B.
Esteban Arango B. - avatar
1 Antwort
+ 4
You can do something like this if user scroll >= userScroll run your code window.addEventListener("scroll", function (event) { var scroll = this.scrollY; if(scroll >= 200){ document.getElementById('video').play(); } });
11th May 2020, 1:34 AM
Sudarshan Rai
Sudarshan Rai - avatar