refactored code for easy of reading
started on spicy
This commit is contained in:
@@ -22,18 +22,17 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<img id="images" src="img1.jpg" alt="images">
|
||||
<img id="images" src="base.png" alt="images">
|
||||
<script>
|
||||
fetch("/files")
|
||||
.then(res => res.json())
|
||||
.then(files => {
|
||||
console.log(files);
|
||||
const images = files
|
||||
let index = 0;
|
||||
setInterval(() => {
|
||||
index = (index + 1) % images.length;
|
||||
document.getElementById("images").src = images[index];
|
||||
}, 10000);
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user