Swiper
サムネイル付きスライダー
HTML
CSS
.swiper__content {
position: relative;
padding: 0;
width: min(100%, 700px);
margin: 0 auto 50px;
}
.swiper {
display: flex;
}
.swiper-slide img {
width: 100%;
height: auto;
}
.swiper-thumb {
margin-top: 5px;
overflow: hidden;
}
.swiper-thumb .swiper-slide {
width: calc(100% / 4);
}
.swiper-thumb .swiper-slide {
opacity: .5;
transition: opacity .5s ease;
cursor: pointer;
}
.swiper-thumb .swiper-slide.swiper-slide-thumb-active {
opacity: 1;
}
script
const swiper = new Swiper(".swiper", {
loop: true,
// ページネーション
pagination: {
el: ".swiper-pagination",
clickable: true, //ページネーションのクリックを有効にする
},
// 矢印
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
}
});





