Try this

$(document).ready(function(){
        var $img = $('img').load(function (){
                alert('loaded!');
        }).appendTo('body').attr('src',$img.src);
});

It takes the images from the page and preloads them. Can't remember
where I found it so sorry that I can't credit the right person.



On Dec 14, 6:24 am, ekallevig <[EMAIL PROTECTED]> wrote:
> I'm having some issues preloading images with jquery in IE.
>
> I tried just creating the image in memory with the appropriate source like
> this:
> $(' ').attr('src',iBuildThePathHere);
>
> But only Firefox will preload the image that way. The only way I've been
> able to successfully achieve the preloading in IE is to create the image
> element like above, then insert it in my document and then hide it instantly
> like this:
> $(' ').attr('src',iBuildThePathHere).insertAfter($('#someElement')).hide();
>
> All the tutorials on preloading images I've read seem to indicate that you
> can simply create an image element (with jquery or with basic js like new
> Image() or document.createElement('img')) in memory and never actually
> append it to the document.  Anybody else ever run into this?
> --
> View this message in 
> context:http://www.nabble.com/preloading-images-with-jquery-in-IE-tp14330317s...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to