<div id="swiper01" class="swiper">
<div class="swiper-wrapper">
<div class="swiper-slide slide1">
<p>3秒毎に切り替わる:1枚め</p>
</div>
<div class="swiper-slide slide2">
<p>3秒毎に切り替わる:2枚め</p>
</div>
<div class="swiper-slide slide3">
<p>3秒毎に切り替わる:3枚め</p>
</div>
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<div class="swiper-scrollbar"></div>
</div>
<div id="swiper02" class="swiper">
<div class="swiper-wrapper">
<div class="swiper-slide slide1">
<p>スライドの逆再生:1枚め</p>
</div>
<div class="swiper-slide slide2">
<p>スライドの逆再生:2枚め</p>
</div>
<div class="swiper-slide slide3">
<p>スライドの逆再生:3枚め</p>
</div>
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<div class="swiper-scrollbar"></div>
</div>
<div id="swiper03" class="swiper">
<div class="swiper-wrapper">
<div class="swiper-slide slide1">
<p>スライドに触っても自動再生を止めない:1枚め</p>
</div>
<div class="swiper-slide slide2">
<p>スライドに触っても自動再生を止めない:2枚め</p>
</div>
<div class="swiper-slide slide3">
<p>スライドに触っても自動再生を止めない:3枚め</p>
</div>
</div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<div class="swiper-scrollbar"></div>
</div>
</body>
.swiper {
width: 90%;
height: 200px;
margin: 0.5rem auto;
}
.swiper-slide {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
font-weight: bold;
}
.slide1 {
background-color: #88acbd;
}
.slide2 {
background-color: #99cb1f;
}
.slide3 {
background-color: #e43a47;
}
const swiper01 = new Swiper("#swiper01", {
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev"
},
autoplay: {
delay: 3000
}
});
const swiper02 = new Swiper("#swiper02", {
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev"
},
autoplay: {
reverseDirection: true
}
});
const swiper03 = new Swiper("#swiper03", {
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev"
},
autoplay: {
disableOnInteraction: false
}
});