desandro / imagesloaded

:camera: JavaScript is all like "You images done yet or what?"
https://imagesloaded.desandro.com
MIT License
8.88k stars 1.15k forks source link

Doesn't work when setting the src #275

Closed Gruski closed 6 years ago

Gruski commented 6 years ago

Event triggers on initial render but not if subsequently the src is set multiple times through javascript to new URL. I would expect it to trigger the event every time the src is changed.

desandro commented 6 years ago

I would expect it to trigger the event every time the src is changed.

Sorry! This is not how imagesLoaded was designed to work. You can build your own solution to track that sort of change, listening for load or error event.

Gruski commented 6 years ago

On load is not reliable for cached images and error event is not appropriate if there is no error. That's the whole reason we needed an imagesloaded library to begin with. So neither are a good solution. Hope you can add this ability since the library seems incomplete without it.