マウスでスワイパースライドの自動再生を停止するにはどうすればよいですか?私は.stopAutoplay()と.startAutoplay()関数を試しましたが、私のために働いていません。マウスでスワイパースライドの自動再生を停止するマウスを離したときに自動再生を開始して開始する
こちらのコードはありがとうございます。そして私は、コンソールエラーに捕捉されない例外TypeErrorに直面:.startAutoplayは、あなた自身がドキュメントについてはこちらを参照してイベントを結合するのではなくオプションdisableOnInteraction:true
を使用する必要がある機能
var swiper = new Swiper('.swiper-container', {
pagination: '.swiper-pagination',
paginationClickable: true,
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
spaceBetween: 0,
loop: true,
effect: 'slide',
longSwipes: true,
autoplay:2000,
autoplayDisableOnInteraction:true,
});
$(".swiper-container").mouseenter(function(){
swiper.stopAutoplay();
});
$(".swiper-container").mouseleave(function(){
swiper.startAutoplay();
});
「autoplayDisableOnInteraction」ではなく「disableOnInteraction」のようなオプションはありません。 –