ページの下の方にswiperで作成したスライダーがあり、ページが読み込まれた時点でループ再生が動いてしまい、スライダー部分までスクロールすると自動スライドが後半の方になってしまいます。
画面に表示されてから自動再生を行う方法はありますでしょうか?
■Swiper 4.4.2を利用しています。
▽現状のコード
jQuery
1 $(window).load(function() { 2 var swiper = new Swiper('.swiper', { 3 centeredSlides: true, 4 navigation: { 5 nextEl: '.swiper-button-next', 6 prevEl: '.swiper-button-prev', 7 }, 8 loop: true, 9 autoplay: { 10 delay: 7000, 11 }, 12 pagination: { 13 el: '.swiper-pagination', 14 type: 'bullets', 15 clickable: true, 16 renderBullet: function (index, className) { 17 return '<li class="' + className + '">' + (index + 1) + '</li>'; 18 } 19 }, 20 }); 21 $(".swiper-container").mouseenter(function(){ 22 swiper.autoplay.stop(); 23 }); 24 $(".swiper-container").mouseleave(function(){ 25 swiper.autoplay.start();; 26 }); 27 }); 28
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/21 05:31