Hello, I am trying to preload some images using either one of the functions below. They don't seem to load. I really could use your help here.
/// 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, passing the desired image pathnames as arguments: $.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 to a div element: $(document).ready( function(){ images = $('img'); $('#imagePanel').append(images) }); The images will not load. What is wrong here? Thank you,