SwiperJS loop not working on hover function

50 Views Asked by At

So I have this issue with a swiper with loop: true; slidesPerView: 'auto', that is also controllable through this function:

$('.project-title').hover(function () {
    const dataId = $(this).data('id');
    const targetSlide = $('#' + dataId);
    const targetIndex = targetSlide.index();

    swiper.slideTo(targetIndex, 600, true); 
                
});

When scrolling through it, it makes the loop seamlessly, however, when using this function and reaching the "beginning" or "end" slide it doesn't render the previous or next slides respectively. It should rearrange the slides normally but for some reason doesn't do it with this function.

I was trying to trigger things from the documentation such as swiper.updateSlides() but no luck...

0

There are 0 best solutions below