Runo
05-05-2010, 04:03 PM
1) Script Title: Ultimate Fadeshow
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm
3) Describe problem:
I'm trying to modify the script so it would start showing images only when all images are loaded.
I'm a new "programmer" so I'm not yet comfortable with the javascript logic,
for example this keyword etc.
I have eventually came to this code in my journey:
// ADDED THESE 2 LINES TO FADESHOW FUNCTION
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
}
//THAT FUNCTION
function countLoadedImages( ) {
this.loadedImages++;
if (this.loadedImages == this.theimages.length) {
this.loaded = true;
}
}
//AND THE NESTED IF CONDITION TO START IT
if (iebrowser&&dom||dom) { //if IE5+ or Firefox
if (this.loaded) this.startit();
}
Maybe something like this has already been done with Ultimate fadeshow,
I guess this is what I'm using,
since the Ultimate Fadeshow 2 is rather different.
I've been testing on this site:
http://web.zone.ee/testcss/
Url to the script file, in my test site:
http://web.zone.ee/testcss/fade.js
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm
3) Describe problem:
I'm trying to modify the script so it would start showing images only when all images are loaded.
I'm a new "programmer" so I'm not yet comfortable with the javascript logic,
for example this keyword etc.
I have eventually came to this code in my journey:
// ADDED THESE 2 LINES TO FADESHOW FUNCTION
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
}
//THAT FUNCTION
function countLoadedImages( ) {
this.loadedImages++;
if (this.loadedImages == this.theimages.length) {
this.loaded = true;
}
}
//AND THE NESTED IF CONDITION TO START IT
if (iebrowser&&dom||dom) { //if IE5+ or Firefox
if (this.loaded) this.startit();
}
Maybe something like this has already been done with Ultimate fadeshow,
I guess this is what I'm using,
since the Ultimate Fadeshow 2 is rather different.
I've been testing on this site:
http://web.zone.ee/testcss/
Url to the script file, in my test site:
http://web.zone.ee/testcss/fade.js