首页 > 代码库 > JS侦测设备旋转方向

JS侦测设备旋转方向

window.onload = window.onresize = function initialLoad(){updateOrientation();}function updateOrientation(){    var contentType = ‘‘;    switch(window.orientation){        case 0:            contentType = ‘normal‘;            break;        case -90:            contentType = ‘left‘;            break;        case 90:            contentType = ‘right‘;            break;        case 180:            contentType = ‘flipped‘;            break;    };    alert(contentType);}

  

JS侦测设备旋转方向