swiper: VirtualTranslate and loop not working together

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • Swiper Version: 4.5.0

  • Platform/Target and Browser Versions: Windows, CHROME.

  • Live Link or JSFiddle/Codepen or website with issue: https://jsfiddle.net/u4vqyt7o/

What you did

Initialized autoplay-example with following JS:

var swiper = new Swiper('.swiper-container', {
  spaceBetween: 30,
  centeredSlides: true,
  virtualTranslate: true,
  loop: true,
  autoplay: {
    delay: 2500,
    disableOnInteraction: false,
    waitForTransition: false,
  },
  pagination: {
    el: '.swiper-pagination',
    type: 'fraction',
  },
  navigation: {
    nextEl: '.swiper-button-next',
    prevEl: '.swiper-button-prev',
  }
});

Expected Behavior

Slideshow working correctly (pagination counting correctly and slide classes updating).

Actual Behavior

  • Slideshow get’s stuck on 2nd slide.
  • Swiping working if stuck but navigation not.
  • It also is not working without autoplay.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 15

Most upvoted comments

This is still a bug [v8.4.5]. Loop does not work when virtual is true.

I found out that reseting swiper internal animating flag on slideChangeTransitionStart event make it works again.

var swiper = new Swiper('.swiper-container', {
  …
});

swiper.on('slideChangeTransitionStart', function() {
  setTimeout(function() {
    swiper.animating = false;
  }, 0);
});

Had the same issue when using virtualTranslate and loop both set to true. Then the navigation next/prev will not working. Only the swipe works.

I’m having the same issue. Virtual does not work with loop in true. It only renders the initial slides, and then when it gets to the end of the rendered slide, it gets stuck. Loop doesn’t work and it doesn’t generate the rest of the slides.

@godness84 whoops my bad! I edited my previous comment. Glad it works!