I ran into this problem before.
Preloading seems like a tricky setup. If you pass a list of images
into createElement with FF it will load everything and it will work
great. If you try this with IE it will keep loading the images in and
not wait till the last one was finished. Safari won't let you use
createImage then change the src. Opera won't let me do it at all.

There is a object in mootools called Assets that has a great
preloader. I think you can just load the one module.
http://docs.mootools.net/Remote/Assets.js#images

I tried writing a preloader to take care of this problem, but I never
got it to work with Opera
You can view a demo of it here
http://laserdesignsbyruss.com/jquery.slide_show.js

Check out the preload_images and load_images methods to see how I'm
doing it.

On Sep 25, 7:16 am, dimitrisX <[EMAIL PROTECTED]> wrote:
> hello,
> I am trying to preload some images using the code i found 
> inhttp://www.texotela.co.uk/code/jquery/preload/
> andhttp://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/6d015c53...
> But nobody seems to be having the same problem. What is so obvious
> that i can't see?
> Thank you,
> Dimitris Chrysomallis

Reply via email to