var orientation;
//页面加载时调用
orient();
//用户变化屏幕方向时调用
$(window).bind( 'orientationchange', function(e){
orient();
});
function orient() {
if (window.orientation == 90 || window.orientation == -90) {
//横屏
orientation = 'landscape';
return false;
}
else if (window.orientation == 0 || window.orientation == 180) {
//竖屏
orientation = 'portrait';
return false;
}
}
移动端h5页面监听手机横屏
最新推荐文章于 2024-07-10 10:41:37 发布