Slides disappear to the left when moving backwards using loop and centered mode.

See original GitHub issue

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • Swiper Version: Both 4.0.1 and 4.0.2

  • Platform/Target and Browser Versions: Chrome on Windows

  • Demonstration of behavior: Demonstration of issue

What you did

I created a swiper instance using the following code:

Javascript

var carousel = new Swiper('.swiper-container', {
        direction: 'horizontal',
        centeredSlides: true,
        slidesPerView: 3,
        spaceBetween: 5,
        navigation: {
            nextEl: '.button-next',
            prevEl: '.button-prev'
        },
        slidesOffsetBefore: 400,
        loop: true
    });

HTML

<section class="main-carousel">
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">
                <div class="top-bar"></div><img src="{{ asset('img/carousel/img1.jpg') }}">
                <div class="info-wrapper">
                    <h2>Skainos<br/>Project</h2>
                    <h3>Belfast</h3>
                    <p>
                        Test text.
                    </p>
                    <a href="#" class="btn btn-default">See Project</a>
                    <div class="swiper-controls">
                        <button class="fa fa-chevron-left button-prev"></button>
                        <button class="fa fa-chevron-right button-next"></button>
                    </div>
                </div>
            </div>
            <div class="swiper-slide"><div class="top-bar"></div><img src="{{ asset('img/carousel/img2.jpg') }}">
                <div class="info-wrapper">
                    <h2>Skainos<br/>Project</h2>
                    <h3>Belfast</h3>
                    <p>
                        Test text.
                    </p>
                    <a href="#" class="btn btn-default">See Project</a>
                    <div class="swiper-controls">
                        <button class="fa fa-chevron-left button-prev"></button>
                        <button class="fa fa-chevron-right button-next"></button>
                    </div>
                </div>
            </div>
            <div class="swiper-slide"><div class="top-bar"></div><img src="{{ asset('img/carousel/img3.jpg') }}">
                <div class="info-wrapper">
                    <h2>Skainos<br/>Project</h2>
                    <h3>Belfast</h3>
                    <p>
                        Test Text
                    </p>
                    <a href="#" class="btn btn-default">See Project</a>
                    <div class="swiper-controls">
                        <button class="fa fa-chevron-left button-prev"></button>
                        <button class="fa fa-chevron-right button-next"></button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

Expected Behavior

I expect that the slides should loop both forward and backwards without issue.

Actual Behavior

Slides loop forward (to the right) without any issue, however when moving backwards (to the left), the slides disappear once I hit the first slide, then reappear again.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:10

github_iconTop GitHub Comments

10reactions
teckescommented, Nov 10, 2017

have you tried to add the “loopAdditionalSlides” option? loopAdditionalSlides: 2

0reactions
stale[bot]commented, Oct 4, 2018

This issue has been automatically closed due to inactivity. If this issue is still actual, please, create the new one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues with Swiper Carousel Disappearing - How to Make ...
The Issue When scrolling the slider left or right, it glitches out and disappears. You can bring it back by randomly scrolling in...
Read more >
Add a motion path animation effect - Microsoft Support
To remove and animation, on the slide, click the motion path (dotted line with arrow), and then press Delete. Click the motion path...
Read more >
Video: Set the transition speed - Microsoft Support
A shorter duration means a slide advances faster, and larger numbers make the effect go more slowly. Select the slide that has the...
Read more >
Swiper API
If true , then active slide will be centered, not always on the left side. ... If you use slidesPerView:'auto' with loop mode...
Read more >
How to Move a Lost Off Screen Window Back to Desktop
How to move or find a lost off screen window back to the center of the screen and desktop.Ever dragged a window off...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found