function readDeviceOrientation() { if (Math.abs(window.orientation) === 90) { // Landscape alert(‘横屏‘); } else { // Portrait alert(‘竖屏‘); } } window.onorientationchange = readDeviceOrientation;
时间: 2024-10-25 12:53:05
function readDeviceOrientation() { if (Math.abs(window.orientation) === 90) { // Landscape alert(‘横屏‘); } else { // Portrait alert(‘竖屏‘); } } window.onorientationchange = readDeviceOrientation;