Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Window.getComputedStyle is not an object error

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

like image 503
Nomi Avatar asked Feb 20 '14 05:02

Nomi


People also ask

What is getComputedStyle in JavaScript?

getComputedStyle() method returns an object containing the values of all CSS properties of an element, after applying active stylesheets and resolving any basic computation those values may contain. Individual CSS property values are accessed through APIs provided by the object, or by indexing with CSS property names.

How do you set a computed style?

To set or copy JavaScript computed style from one element to another, we can loop through each style and call the setProperty method to set the styles on the target element. to add a div and a section element. We define the copyNode function that takes the sourceNode and targetNode .

What are computed styles?

The computed style is the style used on the element after all styling sources have been applied. Style sources: external and internal style sheets, inherited styles, and browser default styles.


1 Answers

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

like image 111
Samuel Larcher Avatar answered Sep 29 '22 16:09

Samuel Larcher