maxmarinich / react-alice-carousel

React responsive component for building content galleries, content rotators and any React carousels
MIT License
833 stars 91 forks source link

New feature needed #181

Closed briankitt closed 3 years ago

briankitt commented 3 years ago

I have a situation where I need a carousel that only has about 8 images, but will show 3 images at a time on the screen. But I need the navigation dots to go to each image, not to each page of images. This will give me 8 navigation dots, one for each image. I can't find any way to do it as the code exists now.

I pulled the code, and modified it to make it work how I need it, but thought I would suggest adding this as a feature.

I implemented it by adding a boolean parm, dotPerImage, and implemented it like this:

export const getDotsNavigationLength = (itemsCount = 0, itemsInSlide = 1, autoWidth, dotPerImage) => { if (autoWidth || dotPerImage) { return itemsCount; } if (Number(itemsInSlide) !== 0) { return Math.ceil(itemsCount / itemsInSlide) || 0; } return 0; };

maxmarinich commented 3 years ago

Hi, @briankitt! To enable a required functionality use v2.5.1, set controlsStrategy="alternate". Demo https://maxmarinich.github.io/react-alice-carousel/#basic.