You can use the setInterval
function to change the image each X seconds and array to store the url’s:
HTML
<div id="head">
content
</div>
CSS
#head {
background:#181015 url( ../images/bg_header.jpg) no-repeat;
background-size: cover;
min-height:520px;
}
JS
var head = document.getElementById('head'),
images = ['img1.jpg', 'img2.jpg', 'img3.jpg'],
i = 0;
setInterval(function(){
if (i === images.length) i = 0;
head.style.background = '#181015 url( ../images/' + images[i] + ') no-repeat';
i++;
}, 3000);
solved Changing dynamically CSS DIV Background every certain time [duplicate]