Working with Swiper JS for a slider and want to enable center slides only for the middle slides and not the first and last slides. Is there an easy and configurable way to specify the index of the centered slides in the following?
var swiper = new Swiper('.my-swiper-section', {
slidesPerView: auto,
spaceBetween: 1
});
I came up with the following, but it is now working 100% correctly:
swiper.on('slideChangeTransitionStart', function () {
if (swiper.isBeginning || swiper.isEnd) {
swiper.params.centeredSlides = false;
}
else {
swiper.params.centeredSlides = true;
}
swiper.update();
});