html5 video play by scrolling with the mouse wheel

后端 未结 5 982
無奈伤痛
無奈伤痛 2020-12-30 06:43

I want to be able to make a web page that plays a video forward and backward when they scroll with the mouse wheel up and down. It seems conceivable, via HTML5 and possibly

5条回答
  •  攒了一身酷
    2020-12-30 06:48

    Possibly something like this

    $(document).mousewheel(function(event, delta, deltaX, deltaY){        
        if (deltaY > 0) {
            $(".video-element").get(0).playbackRate = -1;
        } else {
            $(".video-element").get(0).playbackRate = 1;
        }
    
        event.preventDefault();
    });
    

提交回复
热议问题