PLUGIN
I am using a jQuery plugi called lazyload.
What this does is lazy
load images - meaning it does not render them in the browser until the image is within the scope of the viewport.
This is useful when you have a page that has many images, for example, and you don't want it to spend forever with the initial load.
FIREFOX
Ok, so I am also using Firefox
version 23.0.1
PROBLEM
The plug in is great, however when scrolling down after some images I start getting errors where the image doesn't load (just has a generic place holder for a broken image link) and in the console it logs:
Image corrupt or truncated: [image url]
It is not that there is a problem with the image. They all render fine individually.
It is not on a SPECIFIC image as it is random. If I load the page again, the images that were corrupt
may load now, with other images returning a broken link and logging corrupt
in the console.
I searched around for this, and it seems that there is some problem with simultaneous fetches for an <img>
src tag.
Possibly there should be a delay set on the fetch, however you cannot always tell how long the delay should be. And if one image is larger than another, it could still conflict (with a static delay time, as opposed to a complete
callback).
Therefore, I would like to request:
a) If anybody knows of a solution to this (such as catching when the error occurs and re-triggering the load image function)
b) If anybody can propose an $.extend()
to the library above (lazyload) that would create a callback function and wait until all active fetches are complete
before loading the next one (IF this is the problem - I am not sure if it is)
I am not a jQuery ninja so I am a little lost on the code. I could figure it out, but it would probably be dirty...
c) if this is NOT the problem, then some direction as to how I can solve this would be appreciated