function init() {
new Swiper(".swiper", {
slidesPerView: 2,
spaceBetween: 30,
scrollbar: {
el: ".swiper-scrollbar"
},
breakpoints: {
0: {
slidesPerView: 2,
scrollbar: {
enabled: true
}
},
500: {
slidesPerView: 3,
scrollbar: {
enabled: false
}
}
}
});
}
setTimeout(init, 1000);
appendTo: () => document.body,
Еще отдельно вопрос- по структуре кода можно ли оставить в таком виде слайдер в виде списка UL>LI, каждый li завернуть в .swiper-slide или переделать на .swiper-slide> div>button
<ul>
<li></li>
<li></li>
<li></li>
</ul>
<ul class="swiper-wrapper">
<li class="swiper-slide"></li>
<li class="swiper-slide"></li>
<li class="swiper-slide"></li>
</ul>
pagination: {
el: el.querySelector('.swiper-pagination'),
clickable: true
},
navigation: {
nextEl: el.querySelector('.swiper-arrow-next'),
prevEl: el.querySelector('.swiper-arrow-prev')
}
pagination: {
el: ".swiper-pagination",
clickable: true,
},
navigation: {
nextEl: '.button-next',
prevEl: '.button-prev',
},
var swiper = new Swiper(".swiper", {
slidesPerView: 3,
spaceBetween: 20,
pagination: {
el: ".swiper-pagination",
clickable: true,
},
breakpoints: {
// when window width is >= 320px
320: {
slidesPerView: 2,
spaceBetween: 16
},
// when window width is >= 1000px
1000: {
slidesPerView: 3,
spaceBetween: 20
},
}
});