
Originally Posted by
ChasDevlin
I think what I really wanted, was to have a 'rotating' slideshow. That is, seperate slideshows where one is activated at set moments -- like a traditional rotating banner script -- either on page refresh, or day of the week etc.
That seems easy enough. The script already allows for several arrays to be set (from the demo):
Code:
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=["photo1.jpg", "", ""] //plain image syntax
fadeimages[1]=["photo2.jpg", "http://www.cssdrive.com", ""] //image with link syntax
fadeimages[2]=["photo3.jpg", "http://www.javascriptkit.com", "_new"] //image with link and target syntax
var fadeimages2=new Array() //2nd array set example. Remove or add more sets as needed.
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages2[0]=["photo1.jpg", "", ""] //plain image syntax
fadeimages2[1]=["photo2.jpg", "http://www.cssdrive.com", ""] //image with link syntax
fadeimages2[2]=["photo3.jpg", "http://www.javascriptkit.com", "_new"] //image with link and target syntax
After those, you could make a new array of the arrays:
Code:
var shows=[];
shows[0]=fadeimages;
shows[1]=fadeimages2;
Add as many arrays of images to that array as you like, as long as they exist (are defined) above it in the code as in the above example.
Next, say you want a random show, do (right after the above):
Code:
shows.sort(function() {return 0.5 - Math.random();})
Now in the body part of the code, have:
Code:
<script type="text/javascript">
//new fadeshow(IMAGES_ARRAY_NAME, slideshow_width, slideshow_height, borderwidth, delay, pause (0=no, 1=yes), optionalRandomOrder)
new fadeshow(shows[0], 140, 225, 0, 3000, 1, "R")
</script>
A similar thing could be done to get a day of the week show, assuming you have 7 shows, skip the part:
Code:
shows.sort(function() {return 0.5 - Math.random();})
and in the body:
Code:
<script type="text/javascript">
//new fadeshow(IMAGES_ARRAY_NAME, slideshow_width, slideshow_height, borderwidth, delay, pause (0=no, 1=yes), optionalRandomOrder)
new fadeshow(shows[new Date().getDay()], 140, 225, 0, 3000, 1, "R")
</script>
Bookmarks