Skip to content

Commit 82317d0

Browse files
authored
bugfix: carousel.js (#325)
this solves an issue where on large screens the goToElement is skipping items.
1 parent 341e97e commit 82317d0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

carousel/carousel.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ export default class Carousel {
9898
const delta = Math.abs(scrollport.offsetLeft - element.offsetLeft)
9999
const scrollerPadding = parseInt(getComputedStyle(scrollport)['padding-left'])
100100

101-
const pos = scrollport.clientWidth / 2 > delta
102-
? delta - scrollerPadding
103-
: delta + scrollerPadding
101+
const pos = delta - scrollerPadding
104102

105103
scrollport.scrollTo(dir === 'ltr' ? pos : pos*-1, 0)
106104
}

0 commit comments

Comments
 (0)