Comments (5)
The events cache is stored per page load, so next page refresh will load fixed images without any problems. The cache is there only for multiple imagesLoaded calls with overlapping image sets. For example, if I'll do something like this:
$('img').imagesLoaded( fn );
// ... some time later ...
$('#container img').imagesLoaded( fn );
The second imagesLoaded call on $('#container img')
will work with stored events instead of refreshing all cached images.
Also, cached events are stored per image DOM element, so if you want to refresh the image with JavaScript, either replace the element itself, or you can clear the cache for that particular image with:
$.removeData( imgElement, 'imagesLoaded' );
I think I'll update README with events caching documentation.
from imagesloaded.
Behavior added to README.
from imagesloaded.
Though I understand you, I think that removing data to be able to load an image once again is too complicated. If I were you, I would not cache ‘error’. At least error. But I’m not sure how browsers handle loading images. Perhaps your solution is better. :)
from imagesloaded.
You can still reload any image. You have to remove the 'imagesLoaded' data key only if you plan on calling imagesLoaded on the stack with that particular image again within the same page load.
It has no effect on refreshing the page, it has no effect on adding new images, it has even no effect on changing the src
attribute (src
is stored as well, and if another call recognizes that src
has changed, it won't use cached state).
Plus, everyone once they know that image is broken either replaces the image with placeholder, or removes the image completely. I've yet to see any developer who would be running loop to cycle reload broken images until they are properly loaded. That's just retarded :)
from imagesloaded.
You can still reload any image. You have to remove the 'imagesLoaded' data key only if you plan on calling
imagesLoaded on the stack with that particular image again within the same page load.
I think we’re getting to nitty-gritty. :)
I thought the following way:
• load e.g three images: img01, img02, img03
• img02 failed to load
• you DO NOT load the same stack again but only the image that had failed
Sorry if my thinking is a bit academic. :) I just want to be sure that I understand the code. :)
from imagesloaded.
Related Issues (20)
- imagesloaded loading gif with php HOT 3
- It doesn't work with <picture> tag? HOT 1
- Including the imagesloaded.js library causes <source srcset> images to load two versions of the image, increasing bandwidth by ~4x HOT 2
- .bind deprecated HOT 1
- V3 site page not found HOT 2
- desandro.com has expired HOT 1
- Not working with only srcset HOT 5
- MIT License Page HOT 1
- Timing a page loader only to visible images using imagesLoaded [SOLVED] :) HOT 1
- Thanks for your library! HOT 2
- wp + masonry + imagesloaded lazyload = gap between posts HOT 2
- Multiple file type download issue with imagesLoaded, Barba and Swiper
- Some issues -
- Imagesloaded v5 triggers loading of largest image when using srcset HOT 5
- Downloads jpeg image when using picture element in browser that supports modern formats
- obj is not iterable HOT 2
- Warning: noob incoming HOT 1
- Run each function after each image is loaded instead of waiting for every image to load and run all functions at once HOT 2
- Public site is broken HOT 1
- Possible bug with makeArray helper function in 5.0.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imagesloaded.