I am using .load() in jQuery to load in html content, but in this content there are 3/4 images embedded. The success event only fires on .load() when all the html is loaded in and not actually the images, does anyone know a way of preloading the full content of a page?
$('#ajax_loader').hide().load('page.html',function(){
$(this).fadeUp(1000);
});
This is my simple code (rest of it is in the full app), loading in the following code (ie. page.html)
<div>
<div id="slideshow">
<img src="images/img1.jpg" />
<img src="images/img2.jpg" />
<img src="images/img3.jpg" />
</div>
<p>This is some sample content</p>
</div>
I suggest that you don’t use a
fadeInanimation after the images are loaded because of performance degradation it brings. It is usually a good idea tofadeInthe content then start loading the images to ensure that the animation is smooth for as many users as possible.Having said that, of course you can accomplish your original goal if you want to stick with it:
Use a 1×1 blank image as the image
srcattribute and store the real url in thetitle.And your code becomes: