判断手机横屏和竖屏方向


function orient() {
    if (window.orientation == 90 || window.orientation == -90) {
        //ipad、iphone竖屏;Andriod横屏
        $("body").attr("class", "landscape");
        orientation = ‘landscape‘;
        return false;
    }else if (window.orientation == 0 || window.orientation == 180) {
        //ipad、iphone横屏;Andriod竖屏
        $("body").attr("class", "portrait");
        orientation = ‘portrait‘;
        return false;
    }
}//用户变化屏幕方向时调用

$(window).bind( ‘orientationchange‘, function(e){
    orient();
});

判断手机横屏和竖屏方向

上一篇:iOS 12.1更新 tabbar 从二级返回tabbar出现跳动问题


下一篇:总汇/2018手机号正则