From 91f2f2fae3e661f23d333239c619a02865b0b62d Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Wed, 11 Aug 2021 16:02:42 +0300 Subject: [PATCH] fix(scrollbar): fix scrollbar size with `centeredSlides` --- src/modules/scrollbar/scrollbar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/scrollbar/scrollbar.js b/src/modules/scrollbar/scrollbar.js index 0f047654d..7a9727966 100644 --- a/src/modules/scrollbar/scrollbar.js +++ b/src/modules/scrollbar/scrollbar.js @@ -85,7 +85,8 @@ export default function Scrollbar({ swiper, extendParams, on, emit }) { $dragEl[0].style.height = ''; trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight; - divider = swiper.size / swiper.virtualSize; + divider = + swiper.size / (swiper.virtualSize - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); if (swiper.params.scrollbar.dragSize === 'auto') { dragSize = trackSize * divider; } else {