kompose/docs/js/background.js
Charlie Drage 597e7b0fdc
Add new kompose site (#1475)
Adds the new kompose site and moves it to the /docs folder so that it's
compatible with old links as well as gh-pages
2022-01-13 14:05:38 -05:00

26 lines
713 B
JavaScript

$(document).ready(function() {
var bgArray = ['1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg'];
var path = '../img/background/';
secs = 5;
bgArray.forEach(function(img){
// caches images, avoiding white flash between background replacements
new Image().src = path + img;
});
function backgroundSequence() {
window.clearTimeout();
var k = 0;
for (i = 0; i < bgArray.length; i++) {
setTimeout(function(){
$('#hero').css('background-image', 'url(' + path + bgArray[k] +')');
if ((k + 1) === bgArray.length) { setTimeout(function() { backgroundSequence() }, (secs * 1000))} else { k++; }
}, (secs * 1000) * i)
}
}
backgroundSequence();
});