Trishah
01-14-2009, 01:57 PM
I found this nice little script that will rotate a repeating background image through a series of images. (see below) I would like to have these images fade instead of simply swap out.
I was looking at the code for the DD Ultimate Fade-in slideshow (v1.51) http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm and was trying to see if there was a way to combine the two. Not being great at writing javascript I thought that someone here might know how to do this.
Your help is greatly appreciated!
Background Image SwapOut Script...
<script language="JavaScript">
<!--
// (C) 2003 CodeLifter.com
// Free for all users, but leave in this header
// =======================================
// set the following variables
// =======================================
// Set speed (milliseconds)
var speed = 1000
// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
Pic[0]="graphics/an_bg_blackstars.gif"
Pic[1]="graphics/an_goldstars.gif"
Pic[2]="graphics/an_stars.gif"
Pic[3]="graphics/an_starsglow1.gif"
Pic[4]="graphics/blstarbak.gif"
Pic[5]="graphics/galaxy.gif"
// =======================================
// do not edit anything below this line
// =======================================
var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++){
preLoad[i] = new Image()
preLoad[i].src = Pic[i]
}
function runBGSlideShow(){
if (document.body){
document.body.background = Pic[j];
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runBGSlideShow()', speed)
}
}
//-->
</script>
I was looking at the code for the DD Ultimate Fade-in slideshow (v1.51) http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm and was trying to see if there was a way to combine the two. Not being great at writing javascript I thought that someone here might know how to do this.
Your help is greatly appreciated!
Background Image SwapOut Script...
<script language="JavaScript">
<!--
// (C) 2003 CodeLifter.com
// Free for all users, but leave in this header
// =======================================
// set the following variables
// =======================================
// Set speed (milliseconds)
var speed = 1000
// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
Pic[0]="graphics/an_bg_blackstars.gif"
Pic[1]="graphics/an_goldstars.gif"
Pic[2]="graphics/an_stars.gif"
Pic[3]="graphics/an_starsglow1.gif"
Pic[4]="graphics/blstarbak.gif"
Pic[5]="graphics/galaxy.gif"
// =======================================
// do not edit anything below this line
// =======================================
var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++){
preLoad[i] = new Image()
preLoad[i].src = Pic[i]
}
function runBGSlideShow(){
if (document.body){
document.body.background = Pic[j];
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runBGSlideShow()', speed)
}
}
//-->
</script>