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-10-05 07:18:15