react-carousel
react-carousel copied to clipboard
Active classname for all visible elements
Is your feature request related to a problem? Please describe. I'm not 100% sure if it's a feature request, bug or is it already possible with current version.
Describe the solution you'd like
Right now if slidesPerPage > 1
, only one item gets className BrainhubCarouselItem--active
. Is there a way to add this className to every currently visible element? Or something else, like BrainhubCarouselItem--visible
etc...
Describe alternatives you've considered I tried working around it by altering classnames of children passed down to carousel and calculating (or assuming) when they are visible, but I think it's mixing responsibilities, so I dropped this idea.
Additional context Add any other context or screenshots about the feature request here.
Thanks in advance for your help!
@PiotrSzlagura
It seems to be a bug. Thanks for reporting. Maybe we'll fix that but your PR will be more than welcome.
I'll try to approach this today :)
@PiotrSzlagura
We decided to improve your PR.
Or maybe you could do that but you need to consult that with @RobertHebel and @humbak .
I got a little bit lost with my assumptions and then forgot about this thread, sorry. Please tell me if my thinking is correct:
- If
slidesPerPage
is integer, then there are no partially visible items - If
slidesPerPage
is float, then there are two partially visible items: one before first visible, and one after last visible item - There can never be more than 2 partially visible items.
Am I right?
@PiotrSzlagura
IMO slidesPerPage
should be always an integer.
@piotr-s-brainhub I don't agree. Having possibility to set non-integer slidesPerPage is common in sliders libs (intentional or not) and I personally am using it a lot, so I think it's good that it's there.
@PiotrSzlagura
So I'm OK with that, it can be a non-integer.