Problem with preloading images into fadeshow

Hi

I’m still struggling with loading the images into fadeshow.

I found this:
http://208.75.149.97/forums/showthread.php?p=24193

In that forum they seem to have done it, but when I do it on my site, then it won’t work. I added the function into fade.js.

http://web.zone.ee/testcss/

What they did on that forum post doesn’t do what you want. You want to delay the starting of the slideshow until the images have loaded. You can’t unless you modify the script. I told you what needs to be done previously.

The script already preloads(look for the preload images comment), but doesn’t wait for the images to finish loading before starting the slideshow. Both the preloading code you’ve been creating, and that forum post, needlessly duplicate it.

hmm, with the innerHTML?

I’ve found something, about delaying:
http://www.dynamicdrive.com/forums/archive/index.php/t-46074.html

So I’m trying to add:


function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder, startdelay)
// 
this.startdelay=startdelay

if (iebrowser&&dom||dom) { //if IE5+ or Firefox
setTimeout(this.startit(), this.startdelay || 0);
}

Yet, it doesn’t seem to work, I tried setting the timedelay manually, but nothing.

Or I could tie the postimages preloading with startit() and time delay.
Hmmm… I must think.

Ok, I’ve been doing some coding.
But the Firefox JS console is giving me some errors,
firstly this.theimages are undefined.
If I define it

var showfade = this;

and replace “this.” with the var, then there are no errors but, it doesn’t work.


// ADDED THESE 2 LINES
this.loaded = false;  
this.loadedImages = 0;

// ADDED THE ONLOAD EVENT
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
this.postimages[p].onload = countLoadedImages; //THIS SPECIFICLY
}

//THIS FUNCTION
function countLoadedImages( ) {
this.loadedImages++;
   if (this.loadedImages == this.theimages.length) {
   this.loaded = true;
   }
}

//AND THE NESTED IF CONDITION
if (iebrowser&&dom||dom) { //if IE5+ or Firefox
   if (this.loaded) this.startit();
}