Reputation: 9175
given the html structure:
<div class="image-container">
<img id="firstslide" src="img/verybig.jpg">
</div>
I wonder if there is an easy and simple way to check
Any hints with that?
Upvotes: 1
Views: 874
Reputation: 2223
jsFiddle: http://jsfiddle.net/FjfvZ/60/
If you're using jQuery:
<div id="loading">Loading</div>
<img id="image" src="image.png" style="display:none"/>
<script>
$('#image').load(function()
{
$('#loading').hide();
$(this).show();
});
</script>
Upvotes: 2
Reputation: 31467
I would do it from CSS, as setting the loader animation image as the background of the selected images:
CSS:
img.loader {
background: url(loader.gif) 50% 50% no-repeat;
}
HTML:
<div class="image-container">
<img id="firstslide" class="loader" style="width: 100px; height: 100px;" src="img/verybig.jpg" alt=""/>
</div>
Upvotes: 3
Reputation: 144709
this provides a simple n good solution:
http://www.appelsiini.net/projects/lazyload
Upvotes: 0
Reputation: 207953
You could use a small loading image as the background image which will be covered up by the actual image once it has loaded.
Here's a jsFiddle example.
Upvotes: 1
Reputation: 20415
I use an image preloader plugin:
http://www.farinspace.com/jquery-image-preload-plugin/
This will give you control to do whatever you want to do.
Upvotes: 1