Skip to content

Commit

Permalink
fix(core): fix slide progress in CSS Mode and centered slides
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Aug 11, 2021
1 parent 21af858 commit 1b0165a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/core/update/updateSlidesProgress.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ export default function updateSlidesProgress(translate = (this && this.translate

for (let i = 0; i < slides.length; i += 1) {
const slide = slides[i];
let slideOffset = slide.swiperSlideOffset;
if (params.cssMode && params.centeredSlides) {
slideOffset -= slides[0].swiperSlideOffset;
}

const slideProgress =
(offsetCenter +
(params.centeredSlides ? swiper.minTranslate() : 0) -
slide.swiperSlideOffset) /
(offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) /
(slide.swiperSlideSize + params.spaceBetween);
const slideBefore = -(offsetCenter - slide.swiperSlideOffset);
const slideBefore = -(offsetCenter - slideOffset);
const slideAfter = slideBefore + swiper.slidesSizesGrid[i];
const isVisible =
(slideBefore >= 0 && slideBefore < swiper.size - 1) ||
Expand Down

0 comments on commit 1b0165a

Please sign in to comment.