You should include the property of what you wish to be transitioned in your style (in this case opacity
, or all
), and depending on browser versions, include multi-browser prefixes:
.loading {
transition: opacity .5s;
-webkit-transition: opacity .5s;
-moz-transition: opacity .5s;
-o-transition: opacity .5s;
}
You may also be able to achieve the same result in a better way using jQuery, and remove the transition:
$('.loading').delay(500).fadeOut(500, function() {
$(this).remove();
});
Another thing to point out is that the hi-res image won't necessarily have loaded within .5 seconds. Here's a good way of checking if the image has loaded: SO