我正在尝试制作带有滑动滚动条的滑块,此刻,每次更改幻灯片时,拖动圆环都移至下一个位置,但是我想使其随着视频拖动而移动,并从左侧平滑移动直到右边而没有停在每个位置。
您知道我该怎么做吗?我尝试使用CSS动画对其进行更改,但是它无法正常工作,并且无法在该库中找到参数来执行此操作。您会建议我使用其他图书馆还是任何解决方案的建议?
PS:我还需要更改进度条的颜色,当圆圈通过时,例如在youtube视频上。
在这里您可以在codepen上找到代码,在上面我还将完整的代码放在上面:
CODEPEN:https://codepen.io/A8-XPs/pen/wYdrVy
HTML:
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img src="https://user-images.githubusercontent.com/883386/35498466-1375b88a-04d7-11e8-8f8e-9d202da6a6b3.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="http://wowslider.com/sliders/demo-22/data1/images/harrypotter975357.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="http://animalsbirds.com/wp-content/uploads/2016/07/Elephants-Animal-Facts.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="http://elkhunting.co/wp-content/uploads/2018/10/pictures-of-the-ocean-floor-download-over-under-pacific-island-underwater-ocean-floor-stock-image-image-of-outer-eroded-pictures-of-the-atlantic-ocean-floor.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="http://geocento.com/wp-content/uploads/2016/02/satellite-spot6-image-bissagos-guinea-bissau-geocento-earth-imaging.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="https://www.itg.ias.edu/files/images/tips/sunset.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="http://www.qygjxz.com/data/out/6/5743277-alone-girl-images.jpg" alt="">
</div>
</div>
<!-- Add Scrollbar -->
<div class="swiper-scrollbar"></div>
</div>
CSS:
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-container {
width: 100%;
height: 100%;
}
.swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
/* Center slide text vertically */
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
}
.swiper-scrollbar-drag{
border-radius:50%;
width: 15px !important;
height:15px !important;
transition-duration: 900ms !important;
}
JS:
var swiper = new Swiper('.swiper-container', {
effect: 'fade',
speed: 900,
scrollbar: {
el: '.swiper-scrollbar',
hide: false,
draggable: true,
},
autoplay: {
delay: 1000,
},
});