Triggering a video autoplay based on scroll position

前端 未结 3 1955
醉梦人生
醉梦人生 2020-12-25 10:08

I am writing a script that uses the Wipe animation from the scrollorama.js script. I am hoping to be able to implement a video to autoplay at certain markers in the scroll d

3条回答
  •  情话喂你
    2020-12-25 10:54

    I figured this out, so i answer my own question with the help of a lot of other answers patched together here!

    If anyone is interested, the html was simple:

        

    Jquery was also simple:

            $(function(){
    
        $(window).scroll(function(e) {
    
            var scrollAmount = $('body').scrollTop();   
            console.log(scrollAmount);
    
    
        if(scrollAmount >="theamountyouwant" && scrollAmount <= "theotheramountyouwant") {
    
    
            $("#videoHolder").html(
                '');
    

提交回复
热议问题