<div class="box">
<div class="slider-nav">
<div class="slide-btn"><span>slide 1</span></div>
<div class="slide-btn"><span>slide 2</span></div>
<div class="slide-btn"><span>slide 3</span></div>
<div class="slide-btn"><span>slide 4</span></div>
<div class="slide-btn"><span>slide 5</span></div>
<div class="slide-btn"><span>slide 6</span></div>
</div>
<div class="slider-dots-box"></div>
</div>
body {
background-color: #ccc;
margin: 0;
padding: 0;
}
.box {
position: relative;
max-width: 80%;
margin: 0 auto;
}
.slider-for {
position: absolute;
left: 0;
right: 0;
top: 0;
z-index: 10;
}
.slide-container {
height: 20vh;
background-color: transparent;
text-align: center;
line-height: 20vh;
font-size: 40px;
font-weight: bold;
border: 0;
margin-bottom: 20px;
box-sizing: border-box;
}
.decor {
padding: 5px 40px;
background-color: #fff;
border: 2px solid #000;
}
.slide-btn {
text-align: center;
box-sizing: border-box;
height: 40vh;
background-color: yellow;
border: 1px solid #000;
cursor: pointer;
display: flex !important;
align-items: flex-end;
justify-content: center;
padding-bottom: 20px;
font-size: 30px;
min-height: 120px;
transition: 0.5s all;
}
.slick-active-first .slide-btn {
background-color: red;
}
.slick-active-last .slide-btn {
background-color: orange;
}
.slider-dots-box {
display: flex;
justify-content: center;
align-items: center;
}
.slider-dots {
display: flex;
justify-content: center;
align-items: center;
min-height: 40px;
}
.slider-dots button {
width: 20px;
height: 20px;
border-radius: 50%;
display: block;
border: 0;
background-color: transparent;
margin: 0 10px;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
padding: 0;
transition: .3s all;
position: relative;
z-index: 0;
}
.slider-dots-box .slick-active button {
width: 40px;
height: 40px;
}
.slider-dots button:after {
content: "";
display: block;
width: 5px;
height: 5px;
border-radius: 50%;
background-color: #000;
}
.slider-dots-box .slick-active button:after {
content: none;
display: none;
}
.slider-dots-box .slick-active button:before {
content: "";
display: block;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: -1;
border: 2px solid rgba(0, 0, 0, 0.05);
border-radius: 50%;
}
.circle-bg {
fill: rgba(255, 255, 255, 0);
stroke: rgba(0, 0, 0, 0.05);
stroke-width: 2;
stroke-linecap: butt;
}
.circle-go {
fill: rgba(255, 255, 255, 0);
stroke: rgb(247, 255, 9);
stroke-width: 2;
stroke-linecap: round;
animation: progress 22s;
stroke-dasharray: 360px;
stroke-dashoffset: 360;
}
.circle-tx {
fill: #000;
stroke-width: 1;
font: bold 16px 'Arial';
text-anchor: middle;
}
@keyframes progress {
from {
stroke-dashoffset: 360;
}
to {
stroke-dashoffset: 0;
}
}
$('.slider-nav').slick({
pauseOnHover: false,
slidesToShow: 3,
slidesToScroll: 1,
dots: true,
autoplay: true,
autoplaySpeed:5000,
focusOnSelect: true,
dots: true,
appendDots: $('.slider-dots-box'),
dotsClass: 'slider-dots',
});
$('.slider-nav').on('beforeChange', function(event, slick, currentSlide, nextSlide){
$('.slider-dots-box button').html('');
}).trigger('beforeChange');
$('.slider-nav').on('afterChange', function(event, slick, currentSlide){
$('.slider-dots-box button').html('');
$('.slider-dots-box .slick-active button')
.html(`<svg class="progress-svg" width="40" height="40">
<g transform="translate(20,20)">
<circle class="circle-go" r="19" cx="0" cy="0"></circle>
<text class="circle-tx" x="0" y="4" alignment-baseline="middle" stroke-width="0" text-anchor="middle">${(currentSlide || 0) + 1}</text>
</g>
</svg>`);
}).trigger('afterChange');