我想通过使用jQuery添加或删除类来使用css过渡来为幻灯片中的元素设置动画。对于例如.addClass()
.removeClass()
或.css()
。我无法理解如何使用Swiper函数,例如slideChangeTransitionStart
,slideChangeTransitionEnd
<script>
var swiper = new Swiper('.swiper-container', {
slidesPerView: 1,
loop: true,
spaceBetween: false,
mousewheel: true,
speed: 1200,
parallax: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
autoplay: {
delay: 4000,
disableOnInteraction: false,
},
slideChangeTransitionStart(Swiper) {
// What I should write here?
},
});
</script>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide slide-01"></div>
<div class="swiper-slide slide-02"></div>
<div class="swiper-slide slide-03"></div>
<div class="swiper-slide slide-04"></div>
</div>
<div class="swiper-pagination"></div>
</div>