Reputation: 4918
When waiting for a bunch of images loading, I want to set a min-wait-time say 200ms. Which means, no matter how fast the images loaded, I will wait for that time, so:
If images loaded in 100ms, I wait for 200ms
If images loaded in 150ms, I wait for 200ms
If images laoded in 300ms, I wait for 300ms
Is this possible?
Currently I use imagesLoaded
to detect when images loaded, it is usually faster than I expect
container.imagesLoaded(function() {
container.fadeIn();
});
Upvotes: 1
Views: 238
Reputation: 482
I believe a simple call to setTimeout
should do the trick. It will wait 200ms and then keep waiting for the images if they still aren't loaded:
setTimeout(() => {
container.imagesLoaded(function() {
container.fadeIn();
});
}, 200);
Upvotes: 2