Мне нужно менять фон изображения дивов, у меня это получилось, как теперь это зациклить? Пыталась в конце функции вызывать ее саму, все зависало( помогите разобраться
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript">
window.addEventListener("load",function(){
setTimeout(function(){window.scrollTo(0,1)},0);
document.body.className += 'load';
bgChange();
});
function bgChange() {
setTimeout(function (){document.getElementById("first").style.backgroundImage = "url(img/first-02.jpg)";}, 3000);
setTimeout(function (){document.getElementById("first").style.backgroundImage = "url(img/first-03.jpg)";}, 6000);
setTimeout(function (){document.getElementById("second").style.backgroundImage = "url(img/second-02.jpg)";}, 5000);
setTimeout(function (){document.getElementById("second").style.backgroundImage = "url(img/second-03.jpg)";}, 8000);
setTimeout(function (){document.getElementById("third").style.backgroundImage = "url(img/third-02.jpg)";}, 4000);
setTimeout(function (){document.getElementById("third").style.backgroundImage = "url(img/third-03.jpg)";}, 7000);
setTimeout(function (){document.getElementById("fourth").style.backgroundImage = "url(img/fourth-02.jpg)";}, 6000);
setTimeout(function (){document.getElementById("fourth").style.backgroundImage = "url(img/fourth-03.jpg)";}, 8000);
}
</script>
</head>
<body>
<div id="mini_video">
<div class="item">
<a href="#" id="first"><img class="mask" alt="" src="img/mask-mini.png" /></a>
</div>
<div class="item">
<a href="#" id="second"><img class="mask" alt="" src="img/mask-mini.png" /></a>
</div>
<div class="item">
<a href="#" id="third"><img class="mask" alt="" src="img/mask-mini.png" /></a>
</div>
<div class="item">
<a href="#" id="fourth"><img class="mask" alt="" src="img/mask-mini.png" /></a>
</div>
</div>
</body>
</html>