Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination issue with loop, slidesPerGroup, slidesPerView #6472

Closed
5 of 6 tasks
beebmx opened this issue Mar 8, 2023 · 15 comments
Closed
5 of 6 tasks

Pagination issue with loop, slidesPerGroup, slidesPerView #6472

beebmx opened this issue Mar 8, 2023 · 15 comments

Comments

@beebmx
Copy link

beebmx commented Mar 8, 2023

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/sandbox/swiper-slides-per-view-forked-hhfxgt

Bug description

The pagination works randomly with loop, slidesPerGroup and slidesPerView.
This issue appears when is not exactly the number of elements in every group, and in the end, the paginator can not calculate the right position of the current page.

To reproduces in the link just go at the last dot of the pagination and it won't set the last page, but then if click on the first page, the random paginations appears, just trying to go last pages and first page.

Expected Behavior

No response

Actual Behavior

No response

Swiper version

9.1.0

Platform/Target and Browser Versions

Safari, Chrome, Firefox

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
@james0r
Copy link

james0r commented Mar 12, 2023

I don't know if this is the same issue but maybe. I confirmed that the OP of this https://stackoverflow.com/questions/75450242/swiper-js-loop-when-slidesperview-is-bigger-than-half-of-the-amount-of-slides is correct about version 9. I reverted to version 8 and it works fine.

@ChiaraLyn
Copy link

Hi everyone,
I'm migrating from Swiper version 8.1.4 to version 9.1.1 and I'm facing the same issue.
I've tried to reproduce it here:
(Bootstrap 5 and Swiper only as asset).

Codepen Issue

It seems that there is a problem with the loop. It vibrates when using the grab and pagination lost focus.
I was forced to go back to the version 8.1.4 because the same behavior occurs with all versions 9.
I wait to hear some god news...!

@lukecharle
Copy link

Think this may be similar to what I've just posted?

#6504

@nhocleopro
Copy link

Same issue

@benwallis
Copy link

Think this is the same issue?

#6518

@nhocleopro
Copy link

Any update?

@everythinginjs
Copy link

any improvements ?

@catsmeatman
Copy link

In v9.4.0 too

@jalonenbrothers
Copy link

Just posted in a closed issue, so maybe worth posting here - in 9.4.1 as well:

loop and slidesperview set to auto / more than one:
https://earth-turtle.com/demos/swiper.php

  1. open page
  2. click the second pagination bullet: carousel moves wrong way, no slide on the left (only two slides showing)
  3. click the first pagination bullet: no slide on the left, active pagination bullet does not update
  4. click the fifth pagination bullet for similar bug.
  5. keep clicking for more similar pagination issues.

In this demo the navigation appears to work, but I had another slider with same setup where navigation and mouse drag kept skipping a few slides, and navigation also wasn't advancing the bullets in correct order.

I have centeredSlides; true, which seems to be part of the issue, but even with centeredSlides commented out, the pagination bullets break after a while of clicking.

The pagination does not seem to know if it should go left or right when clicking the pagination bullet - sometimes from slide 5, instead of going one step right to slide 6, it'll go multiple steps left to slide 6, and leaves out the left-hand slide completely.

using Swiper 9.4.1

@MrSeaWave
Copy link

I have the same issue 😢 in v9.4.1, see #6768

notload.mov

@mskrzypek
Copy link

Same issue here. In v9.2.4, but also after upgrade to v9.4.1. Downgrade to version 8 solves the problem.

@kevinvugts
Copy link

kevinvugts commented Aug 24, 2023

@nolimits4web when are you planning to fix this?

I can definitely confirm that this is a bug in v9+. Like everyone else v8 works as expected!

@DibyodyutiMondal
Copy link

DibyodyutiMondal commented Aug 27, 2023

I faced this problem myself.
I use navigation and pagination
Pagination was working fine by default. But if I enabled 'loop', then pagination would not work at all.
Navigation buttons worked fine. But, if I clicked any pagination button, it would not work. Clicking on pagination button would also break the autoplay loop.

The solution for me was to add an attribute called data-swiper-slide-index to each swiper-slide. This is basically a zero-based index, and it is used by swiperjs internally to compute which slide is supposed to be active in case of loop.

At least in my setup, this attribute is not added by default by the library. I use swiper elements with angular. My swiper js version is 10. Once I added the attribute with correct values, it was working perfectly.

EDIT: If this is expected behaviour, and developers are supposed to be specifying the index, perhaps an indication of the same in the docs is necessary (unless I have missed it)

image

@benwallis
Copy link

Loop mode rarely works properly if slidesPerView is more than 1

@nolimits4web
Copy link
Owner

Swiper v11 comes with reworked and update loop mode. If your issue is replicated with v11, create a new one

Repository owner locked and limited conversation to collaborators Oct 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests