javascript - 魅族手机没有 window.requestAnimationFrame 这个方法吗?
天蓬老师
天蓬老师 2017-04-10 14:43:47
0
3
359
var requestAnimationFrame = window.requestAnimationFrame || 
                            window.mozRequestAnimationFrame || 
                            window.webkitRequestAnimationFrame || 
                            window.msRequestAnimationFrame;

这段代码在 MX 2 原生浏览器上面报错。

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

répondre à tous(3)
巴扎黑

实测,目前(2014-11-19) mx2 是没有 requestAnimationFrame 的。
降级处理:

  window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame ||
      window.mozRequestAnimationFrame ||
      window.oRequestAnimationFrame || function fakeRequestAnimationFrame(cb, t) {
        setTimeout(cb, t || 1)
      }
伊谢尔伦

补充一下,rAF方法要Android4.4才支持的,具体刻查看: http://caniuse.com/#search=requestAnimationFrame

4.4对国产手机来说算是比较新的了,MIUI你估计也是测试了MIUI6吧,MIUI5都还在4.1呢。

黄舟

安卓手机的浏览器都不支持这个好像。用setTimeout替代或者做降级处理把2

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!