How to fix Window.getComputedStyle is not an objec

2020-08-10 08:06发布

I am trying to use draggabilly available at https://github.com/desandro/draggabilly

it works fine in html. Now when i have tried to add it in wordpress. I am getting following error in firebug console.

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

2条回答
够拽才男人
2楼-- · 2020-08-10 08:29

You are calling init twice. Go through your code and remove one instance.

查看更多
在下西门庆
3楼-- · 2020-08-10 08:40

I received this error testing my project with IE8: finally it was so obvious, this method doen't work with 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!

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! (I suspect it's your case).

查看更多
登录 后发表回答