js 页面事件

 <script>
        // // 页面加载的时候触发
        // window.addEventListener("load", function () {

        // })
        //   页面滚动条
        x.style.display = "none";
        window.addEventListener("scroll", function () {
            if (window.pageYOffset > 70) {
                x.style.display = "block";
            } else {
                x.style.display = "none";
            };
        })


        // 页面尺寸发生变化触发事件
        window.addEventListener("resize", function () {
            console.log(window.innerHeight, window.innerWidth);
        });
    </script>
posted @ 2020-10-18 22:21  Wwink  阅读(171)  评论(0)    收藏  举报