简体   繁体   English

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

[英]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.

相关问题 如何修复TypeError:在firefox中,window.getComputedStyle(...)为null? - how to fix TypeError: window.getComputedStyle(…) is null in firefox? Window.getComputedStyle在Firefox中未实现界面元素错误 - Window.getComputedStyle does not implement interface Element error in Firefox 如何从window.getComputedStyle()或其他函数返回rgba值? - How to return rgba value from window.getComputedStyle() or other function? 如何使用 window.getComputedStyle() 获得全高(包括边距)? - How to get full height (including margins) with window.getComputedStyle()? window.getComputedStyle():如何使用默认值丢弃属性? - window.getComputedStyle(): How to Discard properties with default values? window.getComputedStyle 总是以像素为单位返回测量值 - window.getComputedStyle always returns measurement in pixels 使用 window.getComputedStyle 错误的 css 信息 - Wrong css informations by using window.getComputedStyle Window.getComputedStyle不显示内联样式 - Window.getComputedStyle does not show inline style @testing-library/dom window.getComputedStyle 即使设置了computedStyleSupportsPseudoElements,也会出现“未实现”错误:true - @testing-library/dom window.getComputedStyle “Not implemented” error even after setting computedStyleSupportsPseudoElements: true Window.getComputedStyle的参数1未实现接口Element - Argument 1 of Window.getComputedStyle does not implement interface Element
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM