PDA

View Full Version : Presentational Slideshow Script - random view



hayleyford
08-13-2012, 06:13 PM
1) Script Title: Presentational Slideshow Script

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

3) Describe problem: How can I make the images appear in "random" order so that the user sees different ones every time? Thanks so much!

jscheuer1
08-13-2012, 09:35 PM
Add the highlighted as shown:


//Presentational Slideshow Script- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for legal use

var slideshow_width='100px' //SET SLIDESHOW WIDTH (set to largest image's width if multiple dimensions exist)
var slideshow_height='100px' //SET SLIDESHOW HEIGHT (set to largest image's height if multiple dimensions exist)
var pause=3000 //SET PAUSE BETWEEN SLIDE (2000=2 seconds)
var slidebgcolor="white"

var dropimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
dropimages[0]="image1.gif"
dropimages[1]="image2.gif"
dropimages[2]="image3.gif"

var droplinks=new Array()
//SET IMAGE URLs. Use "" if you wish particular image to NOT be linked:
droplinks[0]="http://www.yahoo.com"
droplinks[1]=""
droplinks[2]="http://www.google.com"

;(function(){
var randar = [], i = dropimages.length;
while(--i > -1){
randar[i] = [dropimages[i], droplinks[i]];
}
randar.sort(function(){return 0.5 - Math.random();});
i = dropimages.length;
while(--i > -1){
dropimages[i] = randar[i][0];
droplinks[i] = randar[i][1];
}
})();
////NO need to edit beyond here/////////////

var preloadedimages=new Array()
for (p=0;p<dropimages.le

hayleyford
08-15-2012, 10:00 AM
Thank you John! You guys are so wonderful on this site! I truly appreciate all your help! Have a great day