我为我的滑块添加了一些带有 GSAP 的动画,这些动画是从 Swiper JS https://swiperjs.com/获得的,一切正常,但如果用户在 Swiper 导航(箭头、点或拖动)上单击多次,我的动画开始碰撞。所以问题是如何在幻灯片更改时禁用单击或滑动?我有简单的代码:
var modernSlider = new Swiper ('.swiper-container', {
slidesPerView: 1,
centerSlides: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
})
modernSlider.on('slideChange', function(){
var $self = $('.swiper-slide');
var $tSpan = $self.find('.text h1 span');
gsap.to($tSpan, {
duration: 0.4,
y: '50px'
})
})
你能帮我吗?提前致谢!