Hi guys,
Working on the random quote generator and I’m trying to have my background images change. I have been googling and cannot find a good solution to this. I currently have a script that “seemingly” is transitioning through images, but is not displaying the images. Could anyone take a look/help me out? Would be greatly appreciated!
This is the JS:
var images = ["bjj2.jpg", "bjj3.jpg"];
$(function () {
var i = 0;
$("#dvImage").css("background-image", "url(images/" + images[i] + ")");
setInterval(function () {
i++;
if (i == images.length) {
i = 0;
}
$("#dvImage").fadeOut("slow", function () {
$(this).css("background-image", "url(images/" + images[i] + ")");
$(this).fadeIn("slow");
});
}, 1000);
});