react-multi-carousel icon indicating copy to clipboard operation
react-multi-carousel copied to clipboard

partialVisible - previousSlide

Open gopimalla2 opened this issue 4 years ago • 8 comments

PartialVisible can only display the next slide. But I have a requirement to display the partial slide of previous too. If I use the center mode, it's auto-adjusting the widths of the cards. Is there any way to get the previous slide too with the partialVisible? What's the reason for ignoring this?

@YIZHUANG

gopimalla2 avatar Apr 26 '20 01:04 gopimalla2

It can be done with centerMode. partialVisible is only designed to show part of the next slide while centerMode is designed to show parts of both the previous and next slides.

e.g. https://codesandbox.io/s/vigorous-proskuriakova-6ipf0?file=/src/App.js

OscarBarrett avatar Jun 05 '20 08:06 OscarBarrett

@OscarBarrett is it true that partialVisibilityGutter does not work with centerMode=true ?

If this is so then how can I define how much of the next / prev item is supposed to show on the left or right hand side without doing additional custom css work?

jacksonkr avatar Jul 21 '20 15:07 jacksonkr

Correct, partialVisibilityGutter only applies when using partialVisible.

centerMode currently works by decreasing the slide width to fit half of a slide on either side of the Carousel. It increases the slidesToShow when calculating the itemWidth by 1 and increases the transform value by half the itemWidth.

It should be possible to add a new prop to allow for control of how much is displayed (e.g. centerGutter), and a PR would be welcome.

OscarBarrett avatar Jul 21 '20 16:07 OscarBarrett

@OscarBarrett I will check into this and let you know what I find out. If I end up adding the functionality I will definitely PR

jacksonkr avatar Jul 21 '20 18:07 jacksonkr

Any updates on this? I would like to implement this.

jtas01 avatar Feb 09 '22 19:02 jtas01

I can't avoid showing previous and next slides, even with centerMode and partialVisibility set to false, anyone has acomplished this ?

rickmujica avatar Oct 21 '22 20:10 rickmujica

I can't avoid showing previous and next slides, even with centerMode and partialVisibility set to false, anyone has acomplished this ?

I am also having this issue.

pmacdonald07 avatar Jan 19 '23 22:01 pmacdonald07

@OscarBarrett

It can be done with centerMode. partialVisible is only designed to show part of the next slide while centerMode is designed to show parts of both the previous and next slides.

e.g. https://codesandbox.io/s/vigorous-proskuriakova-6ipf0?file=/src/App.js

This doesn't work as it is not centered: image

stefann01 avatar May 12 '24 16:05 stefann01