l_mke,
<!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;
}
</style>
</head>
<body>
<h1 style="text-align: center;font-size: 40px; margin: 20px 0;">Слайдер</h1>
<div id="slider">
<img src="https://picsum.photos/id/1002/4312/2868" alt="" class="slide_item">
<img src="https://picsum.photos/id/100/2500/1656" alt="" class="slide_item">
<img src="https://picsum.photos/id/1000/5626/3635" alt="" class="slide_item">
</div>
<script>
let slider = document.querySelector('#slider'),
slides = slider.querySelectorAll('.slide_item'),
len = slides.length, index = len - 1, dir = -1;//dir = 1 направление
(function move()
{
slides[index].style.left = ""
index = (index + dir + len) % len;
slider.appendChild(slides[index]);
slides[index].style.left = dir == -1 ? "100%" : "-100%"
window.setTimeout(move, 5000)
})()
</script>
</body>
</html>