Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export function buildCarousel(container, pagination = true) {
button.setAttribute('aria-label', `${label} frame`);
button.addEventListener('click', () => {
const slideWidth = getSlideWidth(carousel);
const zoomLevel = Number((window.outerWidth / window.innerWidth).toFixed(2));
const visible = getVisibleSlides(container);
const { scrollLeft } = carousel;
const current = Math.round(scrollLeft / slideWidth);
Expand All @@ -237,12 +238,12 @@ export function buildCarousel(container, pagination = true) {
if (current <= 0) {
// Loop to the end
carousel.scrollTo({
left: (slides.length - visible) * slideWidth,
left: (slides.length - visible) * slideWidth * zoomLevel,
behavior: 'smooth',
});
} else {
carousel.scrollBy({
left: -slideWidth * visible,
left: -slideWidth * visible * zoomLevel,
behavior: 'smooth',
});
}
Expand All @@ -254,7 +255,7 @@ export function buildCarousel(container, pagination = true) {
});
} else {
carousel.scrollBy({
left: slideWidth * visible,
left: slideWidth * visible * zoomLevel,
behavior: 'smooth',
});
}
Expand Down