javascript判断手机旋转横屏竖屏
// 横屏竖屏函数
function orientationChange(){
switch(window.orientation) {
case 0: // Portrait
case 180: // Upside-down Portrait
//Javascript to setup Portrait view
window.location.reload();
break;
case -90: // Landscape: turned 90 degrees counter-clockwise
case 90: // Landscape: turned 90 degrees clockwise
//Javascript to steup Landscape view
window.location.reload();
break;
}
}
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", orientationChange, false); // 横屏竖屏时间