Posted By

samuelcotterall on 03/31/08


Tagged

javascript js textmate jquery preload images


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

SmpleJohn
somedirection
joomla
nerdfiles


Preload


 / Published in: jQuery
 

  1. // Preloader
  2.  
  3. $(window).bind('load', function(){
  4. var preload = [
  5. '/assets/images/alert_ticked.jpg',
  6. '/assets/images/alert_unticked.jpg'
  7. ];
  8. $(document.createElement('img')).bind('load', function(){
  9. if(preload[0]) this.src = preload.shift();
  10. }).trigger('load');
  11.  
  12. });

Report this snippet  

You need to login to post a comment.