react-slick icon indicating copy to clipboard operation
react-slick copied to clipboard

centerMode does not show parts of next and previous slides

Open dariobanfi opened this issue 10 years ago • 10 comments

Hi,

Slick carousel center mode shows part of next slides in the following examples: http://kenwheeler.github.io/slick/ (See center mode example). However I cannot manage to replicate this behavior with react-slick, using the same settings of the example.

Is this behavior being modified on purpose, or a pull request is welcome?

dariobanfi avatar Jul 27 '16 08:07 dariobanfi

yes, need to implement centerPadding option. PR is welcome

akiran avatar Jul 27 '16 08:07 akiran

I was just able to implement this recently. Here are the settings I used.

var settings = { adaptiveHeight: true, arrows: true, autoplay: true, centerMode: true, dots: false, infinite: true, initialSlide: 1, nextArrow: <RightNavButton/>, prevArrow: <LeftNavButton/>, responsive: [ { breakpoint: 550, settings: { slidesToShow: 1, variableWidth: false } } ], slidesToShow: 3, speed: 1000, variableWidth: true }

I think the trick is centering with variable width. It does mean that you have to set a size for the slides though. fullscreen_7_27_16__8_52_am

grossmail1 avatar Jul 27 '16 14:07 grossmail1

Hey @grossmail1 , I tried your method and it's quite clever. However don't you have a bug with the first time you slide, where the first one is empty (regardless of initialSlide) and when going to next multiple are skipped at the same time?

dariobanfi avatar Jul 27 '16 16:07 dariobanfi

For example here: https://jsfiddle.net/ambigioz/1fmxsohh/2/

dariobanfi avatar Jul 27 '16 16:07 dariobanfi

I may. I just don't think I noticed it with autoplay: true

grossmail1 avatar Jul 27 '16 16:07 grossmail1

@grossmail1 @dariobanfi @akiran were you able to come up with a solution with no bugs? I am facing the same issue and need help.

sauravskumar avatar Jul 29 '16 08:07 sauravskumar

I didn't find a solution yet..

dariobanfi avatar Jul 29 '16 08:07 dariobanfi

my PR is just been merged. now centerMode with centerPadding should be worked with the latest version v0.12.3

renddiyeh avatar Aug 10 '16 17:08 renddiyeh

@renddiyeh any examples?

sauravskumar avatar Aug 10 '16 17:08 sauravskumar

@sauravskumar here it is https://renddiyeh.github.io/react-slick/ , you can check the centerMode section.

slisk has a default centerPadding = 50px setting, so we just need add centerMode: ture setting to make it work.

renddiyeh avatar Aug 10 '16 18:08 renddiyeh