JS - 监听手机横屏竖屏
// 监听屏幕 window.addEventListener('orientationchange', function() { let orientation = window.orientation; console.log("orientation", orientation); switch(orientation) { case 90: console.log("横屏") break; default: console.log("竖屏"); } })
// 监听屏幕 window.addEventListener('orientationchange', function() { let orientation = window.orientation; console.log("orientation", orientation); switch(orientation) { case 90: console.log("横屏") break; default: console.log("竖屏"); } })