这是我的工作:
function doonOrientationChange() { switch(window.orientation) { case -90: case 90: alert('landscape'); break; default: alert('portrait'); break; }}window.addEventListener('orientationchange', doOnOrientationChange);// Initial execution if neededdoonOrientationChange();* 根据MDN的定义,
*2019年5月更新:
window.orientation已弃用,大多数浏览器均不支持。该事件与window.orientation相关联,因此可能不应该使用。
orientationchange



