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?
1 Resposta
+ 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();
}
});