matthewcrisp / drumhut

0 stars 0 forks source link

Photos on product pages not loading #9

Open matthewcrisp opened 8 years ago

matthewcrisp commented 8 years ago

On the pages for individual djembes, the photos on the right often don't load properly. Seems to happen about 70% of the time. Tends to resolve itself if you refresh once or twice. I thought it was just a problem on my browser, but it turns out it not. Any ideas?

danielcrisp commented 8 years ago

Like this?

screen shot 2016-03-09 at 12 16 02

matthewcrisp commented 8 years ago

Yes, precisely.

danielcrisp commented 8 years ago

It'll be because this bit of code is running before the images are loaded:

https://github.com/matthewcrisp/drumhut/blob/master/website/src/assets/js/custom.js#L19-L24

So the height is calculated while the <div> is empty.

I'll need to add some image load detection to delay the initialisation of the superslides plugin until the images have downloaded.

The reason that a refresh fixes it is because the browser caches the image, so it loads instantly on reload and the height measurement is correct.

matthewcrisp commented 8 years ago

Thank you!