Total beginner looking for guidance on transition effects
Hello all,
I am a total beginner with this, and appreciate any advice given.
Playing around with the following code from an older site on the local server, which simply fades images in/out and was wanting to modify so that it would slide left to right. Should most of this be scrapped in order to make this happen ?
- var howOften = 4; //number often in seconds to rotate
var current = 0; //start the counter at 0
- var items = new Array();
items[0]="<img alt='image1' src='slider/slide-1.jpg' height='469' width='810' border='0' /></a>";
items[1]="<img alt='image2' src='slider/slide-2.jpg' height='469' width='810' border='0' /></a>";
items[2]="<img alt='image3' src='slider/slide-3.jpg' height='469' width='810' border='0' /></a>";
- function rotater() {
document.getElementById("placeholder").innerHTML = items[current];
current = (current==items.length-1) ? 0 : current + 1;
setTimeout("rotater()",howOften*1000);
}
function rotater() {
if(document.layers) {
document.placeholderlayer.document.write(items[current]);
document.placeholderlayer.document.close();
}
if(ns6)document.getElementById("placeholderdiv").innerHTML=items[current]
if(document.all)
placeholderdiv.innerHTML=items[current];
current = (current==items.length-1) ? 0 : current + 1; //increment or reset
setTimeout("rotater()",howOften*1000);
}
window.onload=rotater;
- <layer id="placeholderlayer"></layer><div id="placeholderdiv"></div>