Probably something like this can do:

function showImage(content){
        $("#"+div_name).fadeOut("fast",function(){
                var $div = $(this);
                $(this).html(content).find('img').preload({
                            onFinish:function(){
                                   $div.fadeIn(1500);
                            }
                });
        });
}

That's not the MAIN purpose of the plugin, as you're preloading images
that already loading, but it will (should) handle the final callback
for you.
I'd add the option: placeholder:'some_url.jpg'  so the images don't
start loading by themselves (those on the div).

Note that this whole situation is not ideal, cannot assure you it will
work 100%. Just try :)

--
Ariel Flesler
http://flesler.blogspot.com/

On Oct 7, 6:48 am, janus76 <[EMAIL PROTECTED]> 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
>
> --
> View this message in 
> context:http://www.nabble.com/random-image-and-content-loading-tp19842346s272...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to