I have trouble with swiper slide to slide through the slides, if all slides are shown in current viewport.
The goal i need, is to get the swiper slide active class on the next slide.
the swiper configuration looks like this:
config: SwiperOptions = {
slidesPerView: 'auto',
spaceBetween: 24,
loop: false,
freeMode: false,
updateOnWindowResize: true,
centeredSlides: false,
navigation: false,
width: 357,
breakpoints: {
1300: {
slidesPerView: 3
},
}
};
my slide next function looks like this:
slideNext(){
if (!this.swiper) return;
let activeIndex = this.swiper.swiperRef.activeIndex;
let slidesLength = this.swiper.swiperRef.slides.length;
if (activeIndex < slidesLength - 1) {
this.swiper.swiperRef.slideTo(activeIndex + 1);
}
}
if i set loop to true, it works, but i dont want this behavior.
if the viewport is to small for all slides, it will work too.
any advice how to get this working if all slides are visible?
using: “swiper”: “^8”,