website/assets/js/index.js
RedDuckss 26058d8fa9 Added linting
Added the linter ESLint, added a custom set of rules and fixed linting issues
2018-10-11 04:09:13 -04:00

28 lines
413 B
JavaScript

/* eslint-env browser */
/*
index.js -
the main javascript file
*/
// set some variables
const bg = document.getElementById('hp-bg');
let index = 0;
const imageList = [ '/assets/images/bg1.gif', '/assets/images/bg2.gif' ];
// set the first image
bg.src = imageList[index];
index++;
setInterval(() => {
if (index === imageList.length) {
index = 0;
}
bg.src = imageList[index];
index++;
}, 5000);