5
I have a figure element with a series of images inside:
<figure class="MiniModImgSlider">
<img src="img01.jpg" alt="img01">
<img src="img02.jpg" alt="img02">
<img src="img03.jpg" alt="img03">
<img src="img04.jpg" alt="img04">
<img src="img05.jpg" alt="img05">
</figure>
Note: Images are with display:None.
I want to recover the path of each image and assign to the background of the figure element every 3 seconds. For this I made this script:
var imgs = $(".MiniModImgSlider img").map(function()
{
return $(this).attr('src');
});
for (var i = 0; i <= imgs.length; i++)
{
setInterval(function()
{
$(".MiniModImgSlider").css('background-image', 'url('+imgs[i]+')');
},1000);
}
Only instead of assigning the image path the script returns Undefined! How can I fix this?
Thanks! Solved here.
– João Paulo Saragossa