I'm having a bit of trouble with this piece of code. What I'm trying to do is to animate the transitions between backgrounds. I've tried using fadeIn() & fadeOut() but I'm not sure where to put these. A bit of help would be more than welcome :).
This is my current code:
jQuery(window).load(function(){
var images = ['bg1os.png','bg2os.png','bg3os.png','bg4os.png','bg5os.png',];
var i = 0;
var quotes = ['bg1os.png','bg2os.png','bg3os.png','bg4os.png','bg5os.png',];
setInterval(function(){
jQuery('body').css('background-image', function() {
if (i >= images.length){
i=0;
}
return 'url(' + images[i++] + ')';
}).fadeIn() ;
var random = Math.floor(Math.random()*5)
var disquote = quotes[random]
$('#qtext').html(disquote);
}, 5000);
})