View Full Version : Multiframe Slide Show with Random Images

06-21-2006, 07:47 PM
I have been using the Multiframe Image Slideshow on a website for a while.


Id like to do random images, rather than a specified sequence. Is this possible? One caveat Id like it to either:

a.) blank pause (no images) for a few seconds before beginning the display, or

b.) Display 3 particular images and then continue with the random display.

The reason is that I have a 3 image logo that Id like to be seen for a couple seconds before the images start to overlay on top of it.

As an added bonus, it would be great for either the blank pause (a) or the 3 particular images (b) to occur every so often within in the random sequence.

And bonus #2 would be to start a background load of the images while (a) or (b) are first happening.

(yes, Im asking a lot!)

To see the context of what I am doing, have a look:

Thanks in advance.

06-23-2006, 04:52 AM
I'd try adding (in red):

var seqslides=new Array()
//Set Path to Image plus optional URL ("" for no URL):
seqslides[0]=["image1.gif", "http://www.dynamicdrive.com"]
seqslides[1]=["image2.gif", "http://www.javascriptkit.com"]
seqslides[2]=["image3.gif", "http://www.google.com"]
seqslides[3]=["image4.gif", "http://www.yahoo.com"]
seqslides[4]=["image5.gif", "http://www.google.com"]

seqslides.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)

Just after the array definition as shown, and perhaps at other key spots in the code. This will mix up the order. You could also throw in some blank images to the array.