我们知道mobile设备上监测转屏的事件是orientationchange,但这个事件支持得不太好,有些android就不支持orientation事件

zepto.js中扩展了一个 $.support 来检测是否支持orientation

(function($) {
 /**
     * @name $.support
     * - ***orientation*** 检测是否支持转屏事件,UC中存在orientaion,但转屏不会触发该事件,故UC属于不支持转屏事件(iOS 4上qq, chrome都有这个现象)
*/

$.support = $.extend($.support || {}, {
        orientation: !(br.uc || (parseFloat($.os.version) < 5 && (br.qq || br.chrome))) && !($.os.android && parseFloat($.os.version) > 3) && "orientation" in window && "onorientationchange" in window
    });
})(Zepto);
View Code

相关文章:

  • 2021-12-13
  • 2021-08-04
  • 2021-12-03
猜你喜欢
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
相关资源
相似解决方案