<div class="content">
<div id="list">
<img src="images/01.png" alt="">
<img src="images/02.png" alt="">
<img src="images/03.png" alt="">
<img src="images/04.png" alt="">
<img src="images/05.png" alt="">
</div>
<button id="prev"></button>
<button id="next"></button>
<div id="btns">
<span class="current"></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
<script>
var index=0;
$("#next").click(function(){
if(!$("#list>img").is(":animated")){
index++;
if(index>4){
index=0;
}
animate(index)
}
})
$("#prev").click(function(){
if(!$("#list>img").is(":animated")){
index--;
if(index<0){
index=4;
}
animate(index)
}
})
$("#btns span").click(function(){
index=$(this).index();
animate(index)
})
function animate(index){
$("#list img").eq(index).fadeIn(1000).siblings().fadeOut(1000);
$("#btns span").eq(index).addClass("current").siblings().removeClass("current")
}
</script>