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

Fix initial slide index shift with centeredSlides and slidesPerView auto #7319

Merged
merged 1 commit into from
Feb 27, 2024

Commits on Feb 18, 2024

  1. Fix initial slide index shift with centeredSlides and slidesPerView auto

    - Originally observed issue when initialSlide was 0 but reproduced in other cases
    - Investigation found activeColIndexWithShift calculation in loopFix.mjs was adding 0.5 when centeredSlides true, causing slidesPrepended to be decimal number in some cases
    - Non-integer slidesPrepended value then gets rounded down in snapIndex calculation in slideTo.mjs, causing initial slide index to be less than intended
    - Fix by using Math.ceil to round up the slide index variable passed to the slideTo method as argument in loopFix.mjs, ensuring an integer index value is passed to slideTo
    yasuhiro-yamamoto committed Feb 18, 2024
    Configuration menu
    Copy the full SHA
    1e29c78 View commit details
    Browse the repository at this point in the history