View Full Version : Slide show: 1st a random image, then sequential order

11-04-2008, 08:39 PM
1) Script Title: Ultimate Fade-in slideshow (v1.51)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

3) Describe problem:

O.K. not really a problem... the script works great as is. Thanks to those who coded and posted it! This is more like a feature request that I don't know how to implement.

As is the case with most slide shows, you are typically given the option for either RANDOM or SEQUENTIAL slide shows. What more could you want, right?

But, what I would like is a tweak to the existing Ultimate Fade-in slideshow code for the option of: RANDOM image is selected, then the show proceeds in SEQUENTIAL order from that image to its next in the array.

In other words, you wouldn't always be starting the sequence at the very beginning. In a particularly lengthy sequential sideshow, it would be nice to randomize the starting point yet still maintain the sequence of events.

Unfortunately, I am not proficient enough in javascript to do it myself.
I found a similar request, but was unsure how to implement the suggestion, here: http://www.actionscript.org/forums/archive/index.php3/t-127278.html

Any help is greatly appreciated.

11-06-2008, 10:21 PM
Is it possible to have a random starting point (not always the beginning) to a sequential slide show using the ultimate fade-in slide show???

11-07-2008, 12:20 AM
It allows for either the order you set in the array(s), or for that order (for any given array or arrays) to be random. If you choose random, once the random order is set on load, it repeats identically for that array for that page load.

11-07-2008, 03:47 PM
So the answer is NO? One cannot tweak the code to have the sequential slide show have a random starting point?

There is another way I can do what I am trying to achieve but the overhead is not worth it. I could set up the random option using pre-designed animated gifs. The animated gifs maintain the sequence I want. The script set up with the random option gives me the random starting point that I want. Unfortunately, I'm afraid loading a series of 200kb animated images would be too much on page load or otherwise for those on slower connections.

Thanks for replying!

11-07-2008, 06:33 PM
Just about anything can be tweaked. My first answer was to gauge whether or not you knew what the script could do and/or if that would be sufficient. Apparently not, at least not on the second score. However, I really don't get it. Or if I do, I think it would be a bad idea, picture this:

The slide show starts with a random image, it just happens to be the second image, so we get the second image twice in a row. Or we start with the third image, go to the second, then have the third again right away.

What might be good, and what you might actually mean is to start at a random point in the array and go on from there.

After rereading what you wrote, I think that is what you want. I've done mods like that before. I'm eating lunch though as I type this. I'll post a solution in a bit.

11-07-2008, 07:07 PM
OK, in the function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder) replace:

if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){


if (displayorder && displayorder == 'R')
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
else if (displayorder && displayorder == 'Rs'){
displayorder = Math.floor(Math.random() * theimages.length);
theimages = theimages.slice(displayorder).concat(theimages.slice(0, displayorder));
this.postimages=new Array() //preload images
for (var p=0;p<theimages.length;p++){

Now, in your on page call, you may still use the original syntax for for random or non - random order, but if you do:

new fadeshow(fadeimages2, 140, 225, 0, 3000, 0, "Rs")

It will give you a random start point.

11-07-2008, 07:21 PM
LOL. By all means, take lunch!

Yes, what you stated, and what I actually mean, is to start at a random point in the (sequential) array and go on from there.

The sequential slide shows I've seen and/or coded myself always start with the first image and proceed on from there. So whenever the user loads the web page it is always img 1,2,3,... They come back and hour later it is 1,2,3... A day later 1,2,3.

What I would like is for the STARTING POINT of the sequence to be random... so, it may start at img 3, then go to img 4, 5, 6.... or start at img 6, then img 7, 8, 9, etc.

I realize from your perspective you are asking, why not just use random setting then??? Because my images also contain text that only makes sense if kept in a sequential order. Then why not simply use sequential order??? Because my web statistics indicate an end user is never on the page long enough to ever view the images which come later in the sequence.

I am trying to use the script more as a design element on a web page. Not necessarily a slide show in and of itself that would be viewed in its entirety in one sitting.

Make sense?

11-07-2008, 08:10 PM
I implemented the tweak and it is EXACTLY what I was envisioning! A random starting point to an otherwise sequential slide show!

I am always amazed at others' abilities and gifts.

Thanks for your time and effort jscheuer1!

03-26-2010, 08:41 PM
Script Title: Ultimate Fade-in slideshow (v2.1)

I am looking for the exact same solution that is proposed in this thread. However, I noticed that the Ultimate Fade-in slideshow is a newer version than the one being discussed in this thread and I am unsure where to apply the changes as the code have changed.

How would a random starting point to an the sequential slide show be coded in the 2.1 version? Any help is much appreciated!

Many thanks!!!

03-26-2010, 09:09 PM
Ah, I found where I can randomize the starting point on page load by:
displaymode: {type:'manual', pause:2500, cycles:0, wraparound:false, randomize:true}

After implementing that, I see that the image and caption loads randomly on page load but the play order is not sequential in the order that it is listed in the array. Yes, the number (1/4, 2/4, etc) is sequential but image and caption is not.

Any ideas? Thanks for your help!