html5横、竖屏状态 以及禁止横屏



window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", hengshuping, false);

 function hengshuping() {
        if (window.orientation == 90 || window.orientation == -90) {
           //横屏
        } else {
            //竖屏
        }
    }


你可能感兴趣的:(前端攻城)