如何修复Window.getComputedStyle不是对象错误

我试图在https://github.com/desandro/draggabilly上使用draggabilly

它在HTML中工作正常。 现在,当我试图在wordpress中添加它。 我在firebug控制台中遇到以下错误。

TypeError: Argument 1 of Window.getComputedStyle is not an object. return s.getComputedStyle(t, null) 

这是js文件的链接http://draggabilly.desandro.com/draggabilly.pkgd.min.js

我收到了用IE8测试我的项目的错误:最后它是如此明显,这种方法不适用于IE 8!

 Error: Object doesn't support this property or method at: http://... 

我收到这个错误,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://... 

请注意,即使您的window对象正常但查询选择器不返回任何内容,也会弹出上述错误! (我怀疑这是你的情况)。

你正在两次调用init。 浏览您的代码并删除一个实例。

Interesting Posts