swiper slide 재생/정지

summer_joy·2023년 6월 5일
0
<script>
var mySwiper = new Swiper('.swiper-container', {
  // Optional parameters
  //direction: 'vertical',
  loop: true,
  autoplay:{
                delay:1000 //1초의 딜레이를 주고 자동 재생된다
            },
  

  // If we need pagination
  pagination: {
    el: '.swiper-pagination',
  },

  // Navigation arrows
//   navigation: {
//     nextEl: '.swiper-button-next',
//     prevEl: '.swiper-button-prev',
//   },

  // And if we need scrollbar
  scrollbar: {
    el: '.swiper-scrollbar',
  },
})
var sw = 0;
$('.btn_pause').click(function(){
    if(sw==0){
        $('.btn_pause').addClass('on');
        mySwiper.autoplay.stop();
        sw = 1;
    }else{
        $('.btn_pause').removeClass('on');
        mySwiper.autoplay.start();
        sw = 0;
    }
});

});

</script>```
profile
💻 Hello world

0개의 댓글