I want to display temporary image in an HTML page until original image is loaded. How can I do that?
<!-- IMG -->
<img src="original.jpg" temporary-img="temp.jpg"/> <!-- i have no idea how to do that ! -->
I want to display temporary image in an HTML page until original image is loaded. How can I do that?
<!-- IMG -->
<img src="original.jpg" temporary-img="temp.jpg"/> <!-- i have no idea how to do that ! -->
If the original image is still loaded you can make the following in the HTML:
<img src="temp.jpg" id="img" data-original-img="original.jpg"/>
If the DOM is loaded, you can use the image, eg. Exchange as follows:
$(function() {
$('#img').attr('src', $('#img').attr('data-original-img'));
});
Or with Plan JS: http://www.w3schools.com/jsref/event_onload.asp
You can add a background image using CSS.
img {
background: url('temp_image.png') no-repeat;
}