作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所有 Phaser 游戏引擎游戏似乎都会崩溃并出现以下错误,但仅在 Firefox 中,当包含实际 Phaser 游戏的 iframe
由于显示游戏前视频广告而隐藏时。
Type Error "window.computedStyle() is null"
有什么解决办法吗?
最佳答案
我认为您拼错了错误:它是“window.getCompulatedStyle()”。
尝试使用这段代码:
if (/firefox/i.test(navigator.userAgent)){
window.oldGetComputedStyle = window.getComputedStyle;
window.getComputedStyle = function (element, pseudoElt) {
var t = window.oldGetComputedStyle(element, pseudoElt);
if (t === null) {
return {
getPropertyValue: function(){}
};
} else{
return t;
}
};
}
关于javascript - Phaser 使用 Firefox(隐藏 Iframe)崩溃为 null window.compulatedStyle(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51948299/
所有 Phaser 游戏引擎游戏似乎都会崩溃并出现以下错误,但仅在 Firefox 中,当包含实际 Phaser 游戏的 iframe 由于显示游戏前视频广告而隐藏时。 Type Error "win
我是一名优秀的程序员,十分优秀!