js鼠标滚轮事件上滚下滚判断

onmousewheelhtml

<script>
    var scrollFunc = function (e){
        //其实我一开始也不知道用啥
        //console.log(e)咱们能够打印一下
        //而后经过观察看他里面的变量哪一个再上滚下滚时候不一样
        //能够经过这传入值e.deltaY的正负来判断 
        //deltaY大于0为下滚,deltaY小于0为上滚
    }
    window.onmousewheel =scrollFunc
</script>
相关文章
相关标签/搜索