0
This script makes a "slide" inside the body.
My question is: How do I get the slide to 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();
I had done the same procedure but it didn’t work , var slide = Document.getElementById("slide"); I think it was because of the double quotes , I put single quotes and it worked _, Thanks for your help !!
– Thainan Esteves
Then see how to vote and accept: https://answall.com/tour
– Laércio Lopes