nolimits4web / swiper

Most modern mobile touch slider with hardware accelerated transitions
https://swiperjs.com
MIT License
39.89k stars 9.74k forks source link

Loop behavior issue #1858

Closed alex7r closed 6 years ago

alex7r commented 8 years ago

This is a (multiple allowed):

<script>
        var swiper = new Swiper('.swiper-container', {
            pagination: '.swiper-pagination',
            effect: 'coverflow',
            grabCursor: true,
            paginationClickable: true,
            nextButton: '.swiper-button-next',
            prevButton: '.swiper-button-prev',
            spaceBetween: 10,
            centeredSlides: true,
            slidesPerView: 5,
            initialSlide: 2,
            loop: true,
    speed: 800,
            coverflow: {
                rotate: -20,
                stretch: 0,
                depth: 20,
                modifier: 1,
                slideShadows : false
            }
        });
    </script>
<style>

.swiper-container .swiper-slide > div,
.swiper-container .swiper-slide > div img{
  transition: all 800ms ease-in;
  -webkit-transition: all 800ms ease-in;
  -o-transition: all 800ms ease-in;
  -moz-transition: all 800ms ease-in;
}
.swiper-container .swiper-slide > div{
  padding: 40px 20px 20px;
}
.swiper-container .swiper-slide img{
  margin-left: 65px;
  width: 100%;

}
.swiper-container .swiper-slide-next + .swiper-slide img {
  margin-left: -65px;
}
.swiper-container .swiper-slide.swiper-slide-prev img{
  margin-left: 15px;
}
.swiper-container .swiper-slide.swiper-slide-next img{
  margin-left: -15px;
}
.swiper-container .swiper-slide.swiper-slide-prev > div, .swiper-container .swiper-slide.swiper-slide-next > div {
  padding: 20px 10px 10px;
}
.swiper-container .swiper-slide.swiper-slide-active > div {
  padding: 0px;
}
.swiper-container .swiper-slide.swiper-slide-active img {
  margin-left: 0px;
}
</style>
  <div class="swiper-container">
    <div class="swiper-pagination"></div>
    <div class="swiper-wrapper">
        <div class="swiper-slide">
            <div>
                <img src="/templates/template/html/mod_custom/img/img_3-1-1.png" alt="Mobile App 1" class="item-container__img">
            </div>
        </div>
    </div>
</div>

Expected Behavior

Images should go back and go forward smoothly

Actual Behavior

When facing duplicate-slide animation is broken as slide was never .active or .next/prev

My seen investigation

I've been able to find out that reason is in https://github.com/nolimits4web/Swiper/blob/master/dist/js/swiper.js#L3843 it rolls back whole swiper to duplicate-slides instead of swiping to the next one

nolimits4web commented 6 years ago

Issue is closed because of outdated/irrelevant/not actual/needed more information/inactivity.

If this issue is still actual and reproducible for latest version of Swiper, please create new issue and fill the issue template correctly: