我正在使用这个滑块:https ://swiperjs.com/api/
现在,我想在设备宽度等于或小于 515 时启动滑块。为此,我正在使用此 JS 代码,但当设备大于 515 时它不会停止滑块。它应该在设备宽度小于等于515:
var mySwiper = new Swiper('.swiper-container', {
direction: 'horizontal',
slidesPerView: 1,
loop: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
autoplay: {
delay: 3000,
},
breakpoints: {
// when window width is >= 320px
515: {
slidesPerView: 1,
spaceBetween: 20
},
}
});