From ff18e10a5bb15b82e6a70aa304f8294b37108741 Mon Sep 17 00:00:00 2001 From: Roland Date: Wed, 19 Feb 2025 13:03:35 +0100 Subject: [PATCH] bugfix: carousel.js this solves an issue where on large screens the goToElement is skipping items. --- carousel/carousel.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/carousel/carousel.js b/carousel/carousel.js index 4508acc4..e65f3e51 100644 --- a/carousel/carousel.js +++ b/carousel/carousel.js @@ -98,9 +98,7 @@ export default class Carousel { const delta = Math.abs(scrollport.offsetLeft - element.offsetLeft) const scrollerPadding = parseInt(getComputedStyle(scrollport)['padding-left']) - const pos = scrollport.clientWidth / 2 > delta - ? delta - scrollerPadding - : delta + scrollerPadding + const pos = delta - scrollerPadding scrollport.scrollTo(dir === 'ltr' ? pos : pos*-1, 0) }