This script makes a slide inside the body.
My question is: How do I make the slide work inside a specific div?
var imageCount = 0;
var currentImage = 0;
var images = new Array();
images[0] = 'img/01.jpg';
images[1] = 'img/02.png';
images[2] = 'img/03.jpg';
var preLoadImages = new Array();
for (var i = 0; i < images.length; i++)
{
if (images[i] == "")
break;
preLoadImages[i] = new Image();
preLoadImages[i].src = images[i];
imageCount++;
}
function startSlideShow()
{
if (document.body && imageCount > 0)
{
document.body.style.backgroundImage = "url("+images[currentImage]+")";
document.body.style.backgroundAttachment = "fixed";
document.body.style.backgroundRepeat = "no-repeat";
document.body.style.backgroundPosition = "left top";
document.body.style.backgroundSize = "100% 100%";
currentImage = currentImage + 1;
if (currentImage > (imageCount-1))
{
currentImage = 0;
}
setTimeout('startSlideShow()', 5000);
}
}
startSlideShow();