html,
body {
position: relative;
height: 100%;
overflow: hidden;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
.swiper-container {
width: 50%;
height: 100%;
margin-left: auto;
margin-right: auto;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
height: 100%;
opacity: 0.3;
display: flex;
justify-content: center;
align-items: center;
transition: 0.3s all;
}
.swiper-slide-active {
opacity: 1;
background-color: orange;
}
.dots.swiper-horizontal > .swiper-pagination-bullets,
.dots.swiper-pagination-bullets.swiper-pagination-horizontal,
.swiper-pagination-custom,
.dots.swiper-pagination-fraction,
.dots {
position: absolute;
bottom: auto;
left: auto;
right: 30px;
top: 50%;
transform: translateY(-50%);
z-index: 100;
width: auto;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
gap: 20px;
cursor: pointer;
}
.dot {
width: 20px;
height: 20px;
background: transparent;
position: relative;
display: flex;
justify-content: center;
align-items: center;
opacity: 0.7;
}
.dot_active {
opacity: 1;
}
.dot:before {
content: "";
display: block;
width: 10px;
height: 10px;
background-color: tomato;
border-radius: 50%;
}
.dot:after {
content: "";
display: block;
width: 100%;
height: 100%;
border: 1px solid tomato;
border-radius: 50%;
position: absolute;
left: 0;
right: 0;
box-sizing: border-box;
opacity: 0;
transition: 0.3s all;
}
.dot:hover:after {
opacity: 0.5;
}
.dot_active:hover:after,
.dot_active:after {
opacity: 1;
}
var swiper = new Swiper(".swiper-container", {
slidesPerView: 1,
loop: false,
spaceBetween: 30,
pagination: {
el: '.dots',
type: "bullets",
clickable: true,
bulletClass: "dot",
bulletActiveClass: "dot_active",
renderBullet: function (index, className) {
return '<div class="' + className + '"></div>';
},
},
});