if i get it correctly, in the xhtml "content" there's an IMG tag with the image that needs to be pre-loaded. There's a plugin that can do this for you;

http://flesler.blogspot.com/2008/01/jquerypreload.html
http://demos.flesler.com/jquery/preload/

janus76 wrote:
I was wondering if anyone can point me in the right direction with this. i am
pretty new to javascript and jquery so any help would be most appreciated.

I have a homepage which displays a large random image from an array every 10
seconds or so. I have used a variation of the following script to do this.
http://www.davidvanvickle.com/examples/jquery/slideshow/index.htm

However in my case the array contains more than an image file location but
some xhtml.

so I have altered the part of the script which shows the image to the
following:-


function showImage(content)
{
        
        $("#"+div_name).fadeOut("fast",function(){
                
                //$(this).hide();                                               
                        
                $(this).html(content);
                $(this).fadeIn(1500);
                        })              
}

where content is the new xhtml from the array.

This all works perfectly fine. However, on the first load of the random
image I do not get the nice fade in effect due to the image in the xhtml not
being being fully loaded when the fade starts.

Once the image has loaded once (presumable in the browser cache) on
subsequent cycles everything is fine.

As this process runs every 10 seconds, is there a way to preload the content
and image in this period ready for display at the set time?

I can't preload all the content at once as there are many images within the
random content.

I hope this makes sense.

If anyone could help me out and point me in the right direction that would
be great.

Thanks

Janus





Reply via email to