<div class="swiper">
<div class="swiper-wrapper">
<div class="swiper-slide" data-thumb="https://images.unsplash.com/photo-1573865526739-10659fec78a5?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=100&q=60">
<img class="swiper-image" src="https://images.unsplash.com/photo-1573865526739-10659fec78a5?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=600&q=80" alt="">
</div>
<div class="swiper-slide" data-thumb="https://images.unsplash.com/photo-1596854407944-bf87f6fdd49e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTB8fGNhdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=100&q=60">
<img class="swiper-image" src="https://images.unsplash.com/photo-1596854407944-bf87f6fdd49e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTB8fGNhdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=80" alt="">
</div>
<div class="swiper-slide" data-thumb="https://images.unsplash.com/photo-1478098711619-5ab0b478d6e6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTZ8fGNhdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=100&q=60">
<img class="swiper-image" src="https://images.unsplash.com/photo-1478098711619-5ab0b478d6e6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTZ8fGNhdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=80" alt="">
</div>
<div class="swiper-slide" data-thumb="https://images.unsplash.com/photo-1598188306155-25e400eb5078?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MzN8fGNhdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=100&q=60">
<img class="swiper-image" src="https://images.unsplash.com/photo-1598188306155-25e400eb5078?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MzN8fGNhdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=80" alt="">
</div>
<div class="swiper-slide" data-thumb="https://images.unsplash.com/photo-1511275539165-cc46b1ee89bf?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NDF8fGNhdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=100&q=60">
<img class="swiper-image" src="https://images.unsplash.com/photo-1511275539165-cc46b1ee89bf?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NDF8fGNhdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=80" alt="">
</div>
<div class="swiper-slide" data-thumb="https://images.unsplash.com/photo-1596854307943-279e29c90c14?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NjR8fGNhdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=100&q=60">
<img class="swiper-image" src="https://images.unsplash.com/photo-1596854307943-279e29c90c14?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8NjR8fGNhdHxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=600&q=80" alt="">
</div>
</div>
<div class="swiper-pagination"></div>
</div>
html,
body {
position: relative;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.swiper {
width: 100%;
height: 100%;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
display: flex;
justify-content: center;
align-items: center;
}
.swiper-image {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.swiper-pagination {
display: grid;
grid-template-columns: repeat(7, 50px);
grid-auto-rows: 88px;
justify-content: center;
align-items: center;
gap: 0 5px;
bottom: 25px !important;
}
.swiper-pagination-bullet {
grid-column-end: span 2;
width: auto;
height: 112.5px;
margin: 0 !important;
border-radius: 0;
background-color: transparent;
opacity: 1;
clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.swiper-pagination-bullet:nth-child(4) {
grid-column: 2 / span 2;
}
.swiper-pagination-image {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
const swiper = new Swiper(".swiper", {
pagination: {
el: ".swiper-pagination",
clickable: true,
renderBullet(index, className) {
const thumb = this.slides[index].dataset.thumb;
return (
`<div class="${className}">
<img class="swiper-pagination-image" src="${thumb}">
</div>`
);
}
},
});