views:

62

answers:

3

Hi, I want to know whether it is posible to have loader which will run till all the images in the page been loaded to the page . I have a website http://ranjoy.athost.net/ which is having some png large size images, i want all the images to load before the animation start .... plz help

A: 

If I'm understanding you right this would do the job

$( "img" ).ready(function(){
 //code to start animation 
});

edit: a callback is used and is called when all the images in the page have loaded. If you wanted to wait only until certain images have laoded you could try this

$( "img.anim" ).ready(function(){
 //code to start animation 
});

and give all your animation images a class of anim like this

<img src="whatever.png" class="anim" />
neilc
A: 

This has been answered at least once before:

http://stackoverflow.com/questions/476679/preloading-images-with-jquery

karim79
+1  A: 

Have you tried this technique

http://www.filamentgroup.com/lab/update_automatically_preload_images_from_css_with_jquery/

Will do what you need.