Home » Javascript » iDangero.us Swiper loop bug with previous navigation

iDangero.us Swiper loop bug with previous navigation

Posted by: admin August 19, 2018 Leave a comment

Questions:

When moving back through the loop using the “previous” navigation button the slides seem to jump from last to first. Issue seems to happen on all platforms.

Moving forward using navigation works as expected, and dragging works as expected.

I have done a fiddle based off the “Centered Slides + Auto Slides Per View” demo on the Swiper website, adding only the navigation html

<!-- Add Arrows -->
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>

and the options

loop: true,
loopedSlides: 10,
roundLengths: true,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},

JSFiddle here: https://jsfiddle.net/MatraSimca/L063jo3x/17/

In the production site I’m working on I’m using fixed width slides and the issue only seems to occur when adding

roundLengths: true,

With the percentage based widths in the demo fiddle the issue occurs with or without the roundLengths option. Any pointers appreciated…

Answers: