Firefox for Android does not support the orientationchange event but you can achieve the same result by using media query listeners. var mqOrientation = window.matchMedia("(orientation: portrait)"); // The Listener will fire whenever this either…
var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',这段是为了获取移动端屏幕是否翻转(手机重力感应等引起屏幕长宽变化之类的) 'orientationchange' in window 这个是判断在window对象中是否有orientationchange属性,因为orientationchange会遇到兼容性问题,有的浏览器不支持,所以这边做了判断来决定是用orientationchang…