Shah-Check-Image-Load
HTML
<p>1) Below image with class name as 'noImage' has not been loaded:
<br/>
<img class="noImage" src="noimage" />
</p>
<p>2) Below image with class name as 'videothumb' has not been loaded:
<br>
<img class="videothumb" src="http://upload.wikimedia.org/wikipedia/commons/5/5b/Ultraviolet_image_of_the_Cygnus_Loop_Nebula_crop.jpg" />
</p>
CSS
.videothumb {
width: 200px;
height: 200px;
}
JavaScript
$.fn.isLoaded = function (message) {
var $this = $(this);
$this.hide(); // becaues firefox gives a 24*24 dimension
var w = this[0].width;
var h = this[0].height;
$this.show();
if (w > 0 || h > 0) {
return true;
}
return false;
};
alert('Has "noImage" class <img> has been loaded : ' + $('.noImage').isLoaded());
alert('Has "videothumb" class <img> has been loaded : ' + $('.videothumb').isLoaded());