判断移动端设备是横屏还是竖屏
var viewWidth = window.innerWidth; //获取可视区域宽度
var viewHeight = window.innerHeight; //获取可视区域高度
if (viewWidth > viewHeight) { // 宽大于高 横屏
console.log("横屏")
} else {
console.log("竖屏")
}
判断移动端设备是横屏还是竖屏
var viewWidth = window.innerWidth; //获取可视区域宽度
var viewHeight = window.innerHeight; //获取可视区域高度
if (viewWidth > viewHeight) { // 宽大于高 横屏
console.log("横屏")
} else {
console.log("竖屏")
}