Lefseq,
меняем картинки на блоки.
что не так?
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
#slider{
width: 80vw;
height: 80vh;
margin: 0px auto;
position: relative;
border: 3px solid #c0c0c0;
overflow: hidden;
}
.slide_item{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top:0;
transition: all ease-in-out 2s;
float: left;
opacity: 0;
z-index: -10;
background-size: cover;
}
</style>
</head>
<body>
<h1 style="text-align: center;font-size: 40px; margin: 20px 0;">Слайдер</h1>
<div id="slider">
<div style="background-image: url('https://picsum.photos/id/1002/4312/2868')" class="slide_item">1</div>
<div style="background-image: url('https://picsum.photos/id/100/2500/1656')" class="slide_item">2</div>
<div style="background-image: url('https://picsum.photos/id/1000/5626/3635')" class="slide_item">3</div>
</div>
<script>
let slider = document.querySelector('#slider'),
slides = slider.querySelectorAll('.slide_item'),
len = slides.length, index = len - 1, dir = 1;
function move()
{
slides[index].style.opacity = "";
slides[index].style.Zindex = "";
index = (index + dir + len) % len;
slides[index].style.opacity = 1;
slides[index].style.Zindex = 1;
window.setTimeout(move, 10000)
}
window.setTimeout(move, 5000)
</script>
</body>
</html>