为了账号安全,请及时绑定邮箱和手机立即绑定

Pixi.JS无法在移动设备上运行,原因是AccessibilityManager抛出错误

Pixi.JS无法在移动设备上运行,原因是AccessibilityManager抛出错误

德玛西亚99 2021-05-06 18:27:06
当我在chrome中点击“ toogle设备工具栏”,浏览器进入移动模式pixi.js无法正常工作。在三星A3上,我也有同样的问题。bundle.js:19086 Uncaught TypeError: Cannot read property 'appendChild' of null at AccessibilityManager.createTouchHook
查看完整描述

1 回答

?
跃然一笑

TA贡献1826条经验 获得超6个赞

我修好了它。我的错...我试图在文档完全加载之前创建PIXI.Application。在桌面版本中,它没有问题,但是在移动版本中,它的工作不正确,因为使用createTouchHook尝试将子元素追加到文档正文中。


不正确的代码:


let app = new PIXI.Application(config.screen.width, config.screen.height, { transparent: true });


 $(document).ready(function(){

     //some actions with pixi.js

 });

正确的代码是:


$(document).ready(function() {

    let app = new PIXI.Application(config.screen.width, config.screen.height, { transparent: true });

});


查看完整回答
反对 回复 2021-05-20
  • 1 回答
  • 0 关注
  • 267 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信