-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Works fine locally but fires early on production #156
Comments
I just tried it and got the same result, it fires it before all images are loaded |
I occasionally have this issue, regardless of whether on production or locally. |
I'm having the same issue - but only in Firefox for Mac. Could it be there is a timeout in place in case an image won't load? If so, can it be set for a longer period of time? |
I guess it already seems like too many people having the same issue for a coincidence... but hey, only "heytricia" mentioned her setup, which seems like a pretty basic requirement when asking for help. |
Are any of you using rails with asset minification (or something else that rewrites js)? |
+1 |
I'm running this in a PhantomJS environment to render images. imagesLoaded fires early and the images do not yet have their width/height properties set. Works fine on Chrome 40 on Mac OSX 10.9.5 |
Having the same issue in Chrome (both on OSX and iOS). Trying to get the naturalWidth and naturalHeight properties on load and they are both 0 if I just use imagesLoaded().done(). I need to use an extra setTimeout to be able to get the dimensions correctly. I've using the minified version from GitHub without any other modifications. |
Same here. Fires early in Chrome OsX |
I grabbed his 'no-cache' branch - this should fix the issue. I think it just has to do with the file size of the image, and loading them from cache. |
@ktruckenmiller I'm not really sure, but imo Chrome has to load all styles, calculate the layout with the current viewport to finally decide which image sizes should be shown. This could take some time, so this information is not instantly available. Moreover image sizes can also change over time when the viewport size is updated. |
imagesLoaded v3.2.0 has been released, with the internal cache removed. Try out the new version and let me know if this issue persists. |
I can still replicate this behavior with v3.2.0, see far down on this (heavy) page. Search for "imagesLoaded" in the page, I've added a little note there. https://tplrebrand.clientrabbit.com/node/95996 [note: updated link] I put a some logging statements in, you can see that the height of image is not set when imagesLoaded is firing. This is on Chrome 47.0.2526.73 (64-bit), Linux, but I have someone else on Chrome that is running into the problem on Mac. I can also replicate this on my local machine by turning on throttling in the devtools network tab. |
@desandro I think I am on to to something here , same thing Chrome Version 48.0.2564.116, imagesloaded 3.2.0 inside my isotope 16 items , I have 1 vimeo ,1 youtube video and 1 soundcloud, if I remove those, |
I had this problem in Firefox and apparently it was caused by deactivating the browser cache via Firebugs network tab: the images are actually loaded from server, but imagesLoaded fires when they are loaded from cache – something like this. |
I'm just browsing the issues before starting to use imagesloaded... I hope it doesn't sound rude but doesn't this issue make the library pretty close to useless? There's so many cases here and so many browsers, all with the same issue, that the library basically doesn't work. My use case is to have a way of waiting until all images have loaded and only then, taking a snapshot image. So it's crucial it doesn't fire too early, while too late is fine. |
@PandaWood: In my tests I got the impression, that this issue is only caused by developer tools, that modify the caching behaviour. But no warranty ... |
@j0hj0h right thanks. I can use it then since I can guarantee that Developer tools will never be open, as I'm using an embedded Chrome browser. |
I'm having this issue on production 100% of the times and 10% of the times on development. ImagesLoaded fires a lot before the images are loaded. I can reproduce the issue by using the network profiling tools from chrome developer tools accurately. I'm working with Chrome for mac, Version 54.0.2840.98 (64-bit), but I have seen it on safari too. |
@pacu, I'm working mostly in Chrome for mac as well and for me it seems like it is caused by the option |
I had the same issue where production had the images in the grid stacked on top of each other when local looked as expected. Was able to solve it by moving the call to imagesLoaded from: document.addEventListener('DOMContentLoaded', setupGrid); to: window.addEventListener('load', setupGrid); |
Still seeing this behavior but now on mobile browsers. |
Just to confirm that it happens with Chromium Embedded too.. |
I'm seeing this without Dev tools open, and in Chrome, Firefox, Opera, and Safari. Basically if the cache is cleared, ie --first time visit to the page, then everything is jumbled and stacked on top etc... Once a resize takes place, or on subsequent visits without the cache clear or dev tools open with said settings, it works just fine. Not sure what the deal is. I am using this in Vue.js, but everything works, except it seems like ImagesLoaded is not firing correctly that first time. Anyone have any thoughts? |
tried different environments, so far, desktop browsers and ios safari are ok. Only happens on android chrome. Debugged and found there is an issue in masonry when using imagesLoaded: As to the solution, looks like very simple: |
it occurs rarely on my site and is therefore not easily reproducible, but in any case I have also noticed that the images loaded callback is fired too early. Based on the layout adjustments that are then not made at the right time, my layout is completely screwed up. I have solved this by an additional very low timeout, but that is really not a nice solution since that is exactly why I have the imagesLoaded functionality. |
I know this is probably a long-shot, but I have a site where imagesloaded works fine on the local development version, but on production, it fires while images are still being loaded.
Are there any server-specific environmental settings which would affect the way the script works?
The text was updated successfully, but these errors were encountered: