Skip to content

Commit

Permalink
adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbristow committed Oct 25, 2024
1 parent 743726b commit 8c0d3e7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/app/components/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ export default function MultiImageCarousel() {
};

const prevSlide = () => {
setCurrentIndex(
currentIndex === 0 ? images.length - itemsPerView : currentIndex - 1,
);
setCurrentIndex(currentIndex === 0 ? 0 : currentIndex - 1);
};

const nextSlide = () => {
setCurrentIndex((currentIndex + 1) % (images.length - itemsPerView + 1));
const newIndex = currentIndex + 1;
setCurrentIndex(
newIndex > images.length - itemsPerView + 2
? images.length - itemsPerView + 2
: newIndex,
);
// setCurrentIndex((currentIndex + 1) % (images.length - itemsPerView + 1));
};

return (
Expand Down

0 comments on commit 8c0d3e7

Please sign in to comment.