3
I want to do a slide fadein/fadeOut with background images. I have this code that seems to be working except the background image does not change. Any hint?
CSS:
body, html {
width: 100%;
height: 100%;
padding: 0;
margin: 0;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
}
jQuery:
$('body').css({
"background-image":"url(imgs/imgTest.jpg)"
});
var imgsArray = ['imgs/imgTest.jpg', 'imgs/yo.jpg', 'imgs/hey.jpg'];
setInterval(function(){
for (var i = 0; i < imgsArray.length; i++) {
$('body').css({
"background-image": imgsArray[i]
});
}
}, 1000);