I had used a SetInterval jquery function to add a slideshow of few images.The image sourse are stored inside an array and also the time interval of displaying of each image is also stored in an array.The code is working, But I want to add a fadeIn and FadeOut for each image with duration and opacity,How can it be done. The code used is
//timearray- is array storing time for each image
//imagearray- is array storing each image source
//image_div-is div tag in which images are displayed
// total 5 images -so used count inside setInterval
function imageshow() {
var imgfade = setInterval(function () {
$("#img_div").css("background", "url('" + imagearray[count] + "')");
clearInterval(imgfade);
if (count < 4) {
count++;
} else {
count = 0;
};
imageshow()
}, timearray[count]);
}
imageshow();
I need to use fadeIn and FadeOut for each image.
Based on comments clarifying the issue, it looks like
fadeTois the function you want. http://api.jquery.com/fadeTo/