当我在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 });
});
添加回答
举报
0/150
提交
取消