swiper 혼자 멈추는 오류 왜이럴까요 ㅠㅠ
본문
두개를 연달아 넣어두었으며 클래스명도 다 다르게 줬습니다! 초반에는 괜찮게 구현되다가 갑자기 autoplay가 멈추네요ㅠㅠ 왜그럴까요 ...
html
//첫번째 스와이퍼
<div class="swiper-container main_cont05_swiper01" dir="rtl">
<div class="swiper-wrapper">
<div class="swiper-slide main_cont05_01_slide">
<img src="<?php echo G5_THEME_URL?>/img/main_cont05_img01.jpg" alt="">
</div>
<div class="swiper-slide main_cont05_01_slide">
<img src="<?php echo G5_THEME_URL?>/img/main_cont05_img02.jpg" alt="">
</div>
<div class="swiper-slide main_cont05_01_slide">
<img src="<?php echo G5_THEME_URL?>/img/main_cont05_img03.jpg" alt="">
</div>
<div class="swiper-slide main_cont05_01_slide">
<img src="<?php echo G5_THEME_URL?>/img/main_cont05_img04.jpg" alt="">
</div>
<div class="swiper-slide main_cont05_01_slide">
<img src="<?php echo G5_THEME_URL?>/img/main_cont05_img05.jpg" alt="">
</div>
</div>
</div>
//두번째 스와이퍼
<div class="swiper-container main_cont05_swiper02" dir="ltr">
<div class="swiper-wrapper">
<div class="swiper-slide main_cont05_02_slide">
<img src="<?php echo G5_THEME_URL?>/img/main_cont05_img01.jpg" alt="">
</div>
<div class="swiper-slide main_cont05_02_slide">
<img src="<?php echo G5_THEME_URL?>/img/main_cont05_img02.jpg" alt="">
</div>
<div class="swiper-slide main_cont05_02_slide">
<img src="<?php echo G5_THEME_URL?>/img/main_cont05_img03.jpg" alt="">
</div>
<div class="swiper-slide main_cont05_02_slide">
<img src="<?php echo G5_THEME_URL?>/img/main_cont05_img04.jpg" alt="">
</div>
<div class="swiper-slide main_cont05_02_slide">
<img src="<?php echo G5_THEME_URL?>/img/main_cont05_img05.jpg" alt="">
</div>
</div>
</div>
자바스크립트
// main_cont05_swiper01
var main_cont05_swiper_num01 = $('.main_cont05_swiper01').find('.main_cont05_01_slide');
var main_cont05_swiper01 = new Swiper('.main_cont05_swiper01', {
slidesPerView: "auto",
spaceBetween: 10,
autoplay: {
delay: 0,
disableOnInteraction: false,
},
allowTouchMove: false,
touchRatio: 0.2,
speed: 7000,
// freeMode: true,
loop: true,
loopedSlides: main_cont05_swiper_num01.length,
observer: true,
observeParents: true,
});
// main_cont05_swiper02
var main_cont05_swiper_num02 = $('.main_cont05_swiper02').find('.main_cont05_02_slide');
var main_cont05_swiper02 = new Swiper('.main_cont05_swiper02', {
slidesPerView: "auto",
spaceBetween: 10,
autoplay: {
delay: 0,
disableOnInteraction: false,
},
allowTouchMove: false,
// touchRatio: 0.2,
speed: 7000,
// freeMode: true,
loop: true,
loopedSlides: main_cont05_swiper_num02.length,
observer: true,
observeParents: true,
pauseOnFocus: false,
});
답변 1
다음과 같이 해보시겠어요?
// main_cont05_swiper01
var main_cont05_swiper_num01 = $('.main_cont05_swiper01').find('.main_cont05_01_slide');
var main_cont05_swiper01 = new Swiper('.main_cont05_swiper01', {
slidesPerView: "auto",
spaceBetween: 10,
autoplay: {
delay: 5000, // 적절한 값을 설정하세요 (밀리초 단위)
disableOnInteraction: false,
},
allowTouchMove: false,
touchRatio: 0.2,
speed: 7000,
loop: true,
loopedSlides: main_cont05_swiper_num01.length,
observer: true,
observeParents: true,
});
// main_cont05_swiper02
var main_cont05_swiper_num02 = $('.main_cont05_swiper02').find('.main_cont05_02_slide');
var main_cont05_swiper02 = new Swiper('.main_cont05_swiper02', {
slidesPerView: "auto",
spaceBetween: 10,
autoplay: {
delay: 5000, // 적절한 값을 설정하세요 (밀리초 단위)
disableOnInteraction: false,
},
allowTouchMove: false,
speed: 7000,
loop: true,
loopedSlides: main_cont05_swiper_num02.length,
observer: true,
observeParents: true,
pauseOnFocus: false,
});
답변을 작성하시기 전에 로그인 해주세요.