hello, I am trying to preload some images using the code i found in http://www.texotela.co.uk/code/jquery/preload/ and http://www.appelsiini.net/2007/6/sequentially-preloading-images.
/// version 1 jQuery.preloadImages = function() { for(var i = 0; i<arguments.length; i++) { $('<img>').attr('src', arguments[i]); } } /// version 2 (not quite like the original) jQuery.preloadImages2 = function(){ var args = arguments; $(window).bind('load', function(){ var preload = new Array(); for(var i = 0; i<args.length; i++){ preload[i] = args[i]; } $(document.createElement('img')).bind('load', function(){ if(preload[0]){ this.src = preload.shift(); alert(this.src); } }).trigger('load').appendTo('#imagePanel'); }); } I then call one of those functions before the document loads: $.preloadImages( "img/cedefop.jpg", "img/cedefop5.jpg", "img/sap.jpg", "img/igme5.jpg", "img/naxm.jpg", "img/olymp.jpg" ); ...and then i try to append the preloaded images in a div element: $(document).ready( function(){ images = $('img'); $('#imagePanel').append(images) }); The problem is that the images don't seem to get loaded. I understand that an element has to be appended in order to be manipulated, but in this case you cannot append it anywhere, as the document has not been loaded yet. So this call: $('img').size() gives me 0. I also read this post: http://groups.google.gr/group/jquery-en/browse_thread/thread/6d015c5373135c6b/d24b2c5405355156?hl=el&lnk=st&q=jquery+preload&rnum=9#d24b2c5405355156 But nobody seems to be having the same problem. What is so obvious that i can't see? Thank you, Dimitris Chrysomallis