I have a div from template like this :
<div class="parallax-container" data-parallax-img="img/index_photos/2.jpg">
//some content
</div>
and I tried to change the div attribute with jQuery like this :
<script type="text/javascript">
var bgImg = 1;
window.setInterval(function(){
yourFunction();
}, 10000);
function yourFunction () {
++bgImg;
if(bgImg === 4){
bgImg = 1;
}
if(bgImg === 1){
$('.parallax-container').attr('data-parallax-img', "img/index_photos/2.jpg");
}
if(bgImg === 2){
$('.parallax-container').attr('data-parallax-img', "img/index_photos/3.jpg");
}
if(bgImg === 3){
$('.parallax-container').attr('data-parallax-img', "img/index_photos/4.jpg");
}
}
</script>
So now in my browser when i click "inspect element" i can see that the attribute of this div is changing every few seconds but image does not showing at all.