PDA

View Full Version : Ultimate Fade-In Slideshow (v1.5), trying to make modification



rudi souza
06-29-2006, 07:01 PM
Script: Ultimate Fade-In Slideshow (v1.5)
http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm



Hello
First let me say, fantastic job on this Ultimate Fade-In Slideshow (v1.5)

I am trying to modify the way that it caches images for use - Id like the script to only cache the next 3 images that are to be displayed, instead of having to cache all of the files at once.
This is of paramount importance to me as Im working with a large number of large image files.

Any help on that approach would be very appreciated
-I am not too sure if its acceptable to ask for help on custom modifications on your scripts, so Im very sorry if this is frowned upon.
Thanks

jscheuer1
06-30-2006, 03:34 AM
See this thread:

http://www.dynamicdrive.com/forums/showthread.php?t=7203

rudi souza
07-03-2006, 03:24 PM
Thanks John, I was able to include the modified code to preload images.

In that same thread I saw an example of a slideshow that will not only preload, but only play the next image after it is fully loaded in the cache.

Id like to add that to the ultimate fade in slideshow.

Ive seen the example but Im having trouble trying to insert that function in the code:


//Please do not edit below
ads=[]; ct=0;
function switchAd() {
var n=(ct+1)%src.length;
if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
document["Ad_Image"].src = ads[ct=n].src;
}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout("switchAd()",duration*1000);
}
function doLink(){
location.href = url[ct];
} onload = function(){
if (document.images)
switchAd();
}
//-->
</SCRIPT>

as of now a lot of the images are fading out before they (or the next images) are completly loaded

jscheuer1
07-03-2006, 06:29 PM
I don't think that code was linked to that thread, maybe it is and I missed it. I do recognise the code though. It probably can be worked in. The essential part of it is:


ads=[]; ct=0;
function switchAd() {
var n=(ct+1)%src.length;
if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
document["Ad_Image"].src = ads[ct=n].src;
}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout("switchAd()",duration*1000);
}

The ct variable should be able to be pulled from the Ultimate Slide script as it is just a reference to which image number we are dealing with. ads=[] is just an auxiliary array to hold the images for preloading and the 'src' is a bit misleading because it is a reserved word. But in the above code it is being used as an ordinary variable name holding the contents of the primary image array, except where it appears as .src where it is the source (its reserved meaning) of the image object or element it is appended to. This would all replace any existing preloading code and need to set (by being integrated into) one of the functions on hold until .complete is true, similar to (and probably for the same function as) the way the optional mouseover pause does in the U fade script.

rudi souza
07-05-2006, 06:10 PM
Hello John
Ive been trying for some time to figure this one out.

My best guess was to make the function hold on the existing preload you coded,



if (obj.nextimageindex!=0 && obj.postimages[obj.postimages.length-1].src=="") //INC PRELOAD CODE: if next image hasnt been preloaded

obj.postimages[obj.nextimageindex].src=obj.theimages[obj.nextimageindex][0] //INC PRELOAD CODE: preload next image


so that, if the next image hasnt been preloaded, it should hold and wait untill it has been.

I havent been having any success at all, not even at decyphring whats the syntax I should be using for the .complete if statement.

my other try was to change the mouseover function so that instead of triggering in a onmouseever event, it would trigger if the next image havent been loaded. that would work for me since I dont use the mouseover pause function. I had no luck at that too.

I hope you are able to help me further,
thanks

jscheuer1
07-06-2006, 05:37 AM
As sometimes happens, you've confused me with ddadmin. No big deal but, he wrote the original code and the adapted the incremental preload. I have been playing around with adapting it to work like the code you mentioned. That is a rather highly specialized preload routine and was written for a non-fading show which is simpler to deal with. My biggest problem has been figuring out what would be an accurate test to see if things were working right or not. Do you have any ideas on that? I did make up a demo but, am not satisfied with it yet. Let me know what you think:

http://home.comcast.net/~jscheuer1/side/files/u_fade_inc_preload.htm

I also added a number of general fixes to it that I keep telling ddadmn to include:

True Safari compliance
Opera 9 fading (really the same as the Safari fix)
Fix some typos that affect any browsers that use -khtml-opacity

Look bottom right ----->

rudi souza
07-06-2006, 01:23 PM
Hello again
Well testing it for me is actually the easiest part - since all the images im working with range from 300 to 700 kb, I use those and set the timer to 1 second, so I am sure that the time needed to download the image is much higher then 1 second. so if you use very big images and set the timer to 1 second youll be sure to get a good testing at "wait if not preloaded"

I hope thats what you mentioned about the testing.

rudi souza
07-06-2006, 02:40 PM
jscheuer

I saved your test code on my computer and edited to use in my own gallery, it seems to be working just as intented.

I didnt change any of your code (only added my file handling php)

http://www.caiaffa.com/Showcase/testeFadeWaitPre.php

--
ive been testing for some time now and its all good
Good job man, thanks a lot too :)
--
now if only I could get completly rid of the IEs title bar and status border. But from what people told thats not easily doable, or possible at all, on windows SP2 machines

jscheuer1
07-06-2006, 04:20 PM
Looks very good. I see you removed the credit though:

Your page is in violation of Dynamic Drive's usage terms (http://www.dynamicdrive.com/notice.htm), which, among other things, state that the script credit must appear in the source code of the HTML page(s) using the script. Please reinstate the notice first.

I had played around with the script a bit more since my last post and when you found it and am now happy with the code. From viewing your source, I see that (aside from not having the credit) you are using the updated version. I tested this out at 28k baud connection and it worked fine in Opera 9, IE6, and FF1.0.5.

You've got an error here:


window.scrollbars=no

It should be either:


window.scrollbars='no'

or:


window.scrollbars=0

or:


window.scrollbars=false

I'm not sure which one is most valid and effective. All will remove the error, most likely.

Now, as for the title and status, if you give your page a title, the title bar will look much nicer. The status bar will look better without the above error.

rudi souza
07-06-2006, 04:44 PM
oh, my bad. I didnt mean to take out the credits - i overlaped it with the php pasting and never realized i took it out.

Thanks again