Pixabay / jQuery-flexImages

A lightweight jQuery plugin for creating fluid galleries as seen on Flickr and Google Images.
221 stars 53 forks source link

TypeError: Failed to execute 'getComputedStyle' on 'Window' #22

Open ghost opened 8 years ago

ghost commented 8 years ago

I'm getting an javascript type error:

TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

I use the latest (1.0.4) minified version of flexImages and use it like this:

$('.flex-images').flexImages({ rowHeight: 150 });

The Error occurs in Win10 and Linux Mint Chrome Browser (Version 53.0.2785.101 64-bit)

The issue seems to be in row 13 (uncompressed version) of the code:

s = window.getComputedStyle ? getComputedStyle(containers[0], null) : containers[0].currentStyle;

Any ideas or fixes?

STandQdotcom commented 7 years ago

the default class for item container is 'items' as listed here: https://goodies.pixabay.com/jquery/flex-images/demo.html

For example:

where div is container for image and has a class "item"

You might get above error if you don't have item class added. Alternatively you can set your own container class using 'container' property.