orientationchange判断屏幕翻转
window.orientation可以获取屏幕的方向
var orientationTimmer = null; window.addEventListener(window[‘onorientationchange‘] ? ‘orientationchange‘ : ‘resize‘, function(){ clearTimeout(orientationTimmer); orientationTimmer = setTimeout(function(){ if(window.orientation){ switch(window.orientation){ case 90: alert(‘左旋‘) break; case -90: alert(‘右旋‘) break; } } },200); }, false);
时间: 2024-12-16 14:47:24