When using swiper in centeredSlides mode with the loop option set to true, I want a clicked slide to become the centered slide in the swiper carousel. Swiper provides me with the index of the clicked slide, but how can I use it to change the centered slide?
These are my custom options:
slidesPerView: 4.5,
spaceBetween: 20,
updateOnWindowResize: true,
loop: true,
grabCursor: true,
centeredSlides: true,
centeredSlidesBounds: true,
initialSlide: 0,
on: {
click() {
console.log(this.clickedIndex);
},
},