JSFiddle - React, Tailwind, and code Playground
HTML
<img src="http://static.php.net/www.php.net/images/php.gif"/><img src="http://static.php.net/www.php.net/images/php.gif"/>
CSS
img.image-loading {
visibility: hidden;
}
JavaScript
var $imgs = $("img");
$imgs.addClass('image-loading');
(function updateImages() {
setTimeout(function() {
$imgs.one("load", function() {
$(this).removeClass('image-loading');
// to manually trigger onload if image is in cache
}).each(function() {
if (this.complete) {
$(this).trigger("load");
}
});
updateImages();
}, 100);
})();