function readDeviceOrientation() { if (Math.abs(window.orientation) === 90) { // Landscape alert('横屏'); } else { // Portrait alert('竖屏'); } } window.onorientationchange = readDeviceOrientation;
function readDeviceOrientation() { if (Math.abs(window.orientation) === 90) { // Landscape alert('横屏'); } else { // Portrait alert('竖屏'); } } window.onorientationchange = readDeviceOrientation;
转载于:https://www.cnblogs.com/enone/p/4837112.html