Determine whether the mobile device is horizontal or vertical
var viewWidth = window.innerWidth; //获取可视区域宽度
var viewHeight = window.innerHeight; //获取可视区域高度
if (viewWidth > viewHeight) { // 宽大于高 横屏
console.log("横屏")
} else {
console.log("竖屏")
}