[英]How to fix Window.getComputedStyle is not an object error
I am trying to use draggabilly available at https://github.com/desandro/draggabilly 我试图在https://github.com/desandro/draggabilly上使用draggabilly
it works fine in html. 它在html中工作正常。 Now when i have tried to add it in wordpress.
现在,当我试图在wordpress中添加它。 I am getting following error in firebug console.
我在firebug控制台中遇到以下错误。
TypeError: Argument 1 of Window.getComputedStyle is not an object.
return s.getComputedStyle(t, null)
here is a link for js file http://draggabilly.desandro.com/draggabilly.pkgd.min.js 这是js文件的链接http://draggabilly.desandro.com/draggabilly.pkgd.min.js
I received this error testing my project with IE8: finally it was so obvious, this method doen't work with IE 8! 我用IE8测试了我的项目时收到了这个错误:最后它是如此明显,这个方法不适用于IE 8!
Error: Object doesn't support this property or method at: http://...
I received this error with FF that does support this method but I forgot to change window
to my frame window object! 我收到这个错误的FF支持这种方法,但我忘了将
window
更改为我的框架窗口对象!
console.log(getComputedStyle(window.document.querySelector('.tip > .tip.top'), ':after').getPropertyValue('left'));
TypeError: Argument 1 of Window.getComputedStyle is not an object.
at: http://...
Note that the above error pops up even if your window
object is ok but the querySelector
returns nothing! 请注意,即使您的
window
对象正常,但是querySelector
返回任何内容,弹出上述错误! (I suspect it's your case). (我怀疑这是你的情况)。
You are calling init twice. 你正在两次调用init。 Go through your code and remove one instance.
浏览您的代码并删除一个实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.