我想给我造成/。 一切工作都很出色,但形象表面上看上去,而不是 in。
// JavaScript for the fade carousel
const slides = document.querySelectorAll( .carousel-slide );
let currentSlide = 0;
// Show the first slide initially
slides[currentSlide].style.display = block ;
function nextSlide() {
slides[currentSlide].style.display = none ;
currentSlide = (currentSlide + 1) % slides.length;
slides[currentSlide].style.display = block ;
}
// Automatically switch slides every 3 seconds
setInterval(nextSlide, 3000);
.carousel-container {
position: relative;
max-width: 600px;
margin: auto;
overflow: hidden;
}
.carousel-slide {
display: none;
width: 100%;
height: 100%;
}
<div class="carousel-container">
<img class="carousel-slide" src="https://fakeimg.pl/600x200?text=Nurses" alt="Slide 1">
<img class="carousel-slide" src="https://fakeimg.pl/600x200?text=Barbers" alt="Slide 2">
<img class="carousel-slide" src="https://fakeimg.pl/600x200?text=Receptionist" alt="Slide 3">
</div>