0
I created a function that changes the background image of <body>
every 5 seconds, but I also wanted to insert in this function a transition effect between the images: Fade Out to black at the beginning of the transition and then Fade In to the next image. Is there any way to do this (whether Jquery or not)? Here’s the function code:
function BackgroundChange() {
var image = ["one","two","three","four","five","six","seven","eight"];
var index = 0;
window.setInterval(function BackgroundChangeSetImage() {
index = index + 1;
if ((index >= 0) && (index <= 7)) {
document.getElementsByTagName("body")[0].setAttribute("style","background-image: url('images/image_" + image[index] + ".jpg');");
} else {
index = -1;
return BackgroundChangeSetImage();
}
}, 5000);
}
Or even duplicate http://answall.com/q/10560/129
– Sergio