So I tried adding a slideshow with setTimeout, but after adding it other function stopped working. I tried changing setTimeout to setInterval, but also it didn't work.
Here is my code:
window.onload = function () {
setTimeout(function () {
let x = document.querySelector('.loaderWrap')
x.remove();
}, 1500)
}
let i = 0;
let images = [];
images[0] = ''
images[1] = ''
images[2] = ''
function changeImage() {
document.slide.src = images[i];
if(i<images.length - 1){
i++;
}else{
i=0;
}
setTimeout('changeImage()', 1000);
document.querySelector('.prev').onclick = function () {
if(i>0){
i--;
}
}
}window.onload = changeImage;