复制代码代码如下所示:
VaR水平= $(美元。horizontal_screen '); / /自定义横屏模式的提示方式
var =文档= $(文档);
VaR的preventDefault =功能(e){
E.preventDefault();
};
VaR touchstart =功能(e){
document.on美元('touchstart touchmove,preventDefault);
};
VaR touchend =功能(e){
document.off美元('touchstart touchmove,preventDefault);
};

函数侦听器(类型){
如果('add= =型){
{纵向模式}
horizontal.addclass美元('hide);
document.off美元('touchstart,touchstart);
document.off美元('touchend,touchend);
其他{ }
交叉屏幕模式
horizontal.removeclass美元('hide);
document.on美元('touchstart,touchstart);
document.on美元('touchend,touchend);
}
}
功能orientationchange(){
开关(窗口方向){
{纵向模式}
案例0:
案例180:
听众('add);
打破;
交叉屏幕模式
案例90:
案例90:
听众('remove);
打破;
}
}

$(窗口),(onorientationchange 窗口orientationchange :调整

document.ready美元(函数(){()
要进入界面水平屏幕模式,建议只支持垂直屏幕。
如果(window.orientation = 90 | | window.orientation = = 90){
听众('remove);
}
});