I have a code to change image for every fixed intervals but this image is just normally changing. How can I use fadeout option to my code so that it will slowly fadeout to open a new image. My code follows
$(document).ready(function() {
(function() {
var curImgId = 0;
var numberOfImages = 2;
window.setInterval(function() {
$('body').css('background-image','url(bg' + curImgId + '.jpg)');
curImgId = (curImgId + 1) % numberOfImages;
}, 15 * 100);
})();
});