Kris-B / nanoGALLERY

image gallery simplified - jQuery plugin. Touch enabled, responsive, justified/cascading/grid layout and it supports pulling in Flickr, Google Photos and self hosted images.
https://nanogallery2.nanostudio.org/
439 stars 101 forks source link

nanoGALLERY: error on hoverOut n[r].toFixed is undefined [nanoGallery] #86

Closed macsupport closed 7 years ago

macsupport commented 8 years ago

I am getting this error: nanoGALLERY: error on hoverOut n[r].toFixed is undefined [nanoGallery] when using labelAppear, labelAppear75 for thumbNail effects

Kris-B commented 8 years ago

Can you give me a live URL to check this?

andrea-sdl commented 8 years ago

Hi Kris, I just got the same issue like macsupport. At least in our case the issue can be seen when the CSS is dynamically loaded (async-way) and it happens because on the

var c=jQuery.Color($newDiv.find('.labelImage'),'backgroundColor');

it returns transparent because the browser still hasn't interpreted/loaded the nanogallery CSS.

I guess it's no nanogallery fault in this case but it might help fixing this by adding the possibility to offer a "default" value for the labeImage styling values.

Kris-B commented 8 years ago

@andrea-sdl many thanks for the update! I'll implement a fix based on this.

Kris-B commented 8 years ago

@andrea-sdl a fix is implemented in v5.9.0 but I'm not sure it will always work correctly. The default value may be incorrect...

andrea-sdl commented 8 years ago

@Kris-B thanks for the super-fast support. I checked the code and now it will surely work, although you are right, it might not work correctly because it will use "black" as default background, while it might be an issue with async loading (and therefore the css is still not interpreted).

Your fix will work, although it will cause some graphical inconsistency when the problem arise (as you noted).

To evolve it even further we could

  1. Allow some kind of function to be callable externally so that we can reset G.custGlobals.oldLabelRed etc with the right values (after the CSS has been interpreted). I have some ideas on this, maybe I'll try to put them down on code if I got some extra time.
  2. Pass a "default" label rgb-color-background in the init, so instead of 0,0,0 (rgb) we have a more consistent fallback in case of errors. This isn't the cleanest solution but it would probably be the fastest to implement.
Kris-B commented 7 years ago

a workaround is implemented in nanogallery2 (http://nanogallery2.nanostudio.org)