【发布时间】:2020-11-24 05:28:27
【问题描述】:
我正在使用这个滑块: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
},
}
});
【问题讨论】:
标签: javascript swiper swiperjs