I am looking for a way to put all of the images into an array and then use them in a 'slideshow'... Heres what I have so far:
HTML
<div id="header">
</div>
JS
function onload() {
var i = 0;
var imageList= [<?php
$dir='/assets/splashs/';
$files = scandir($dir);
foreach((array)$files as $file){
if($file=='.'||$file=='..') continue;
$fileList[]=$file;
}
?>];
setInterval(function() {
document.getElementById("header").style.backgroundImage="url(imagelist+i)";
i++
},3000);
}
Note: imagelist was taken from another thread
EDIT:
I get the error: Uncaught SyntaxError: Unexpected token < global.js:3
The current code doesn't work, so I wondered if any of you have anything different or are able to fix it?