React-slick: Last item is shown

Created on 10 Jul 2020  路  5Comments  路  Source: akiran/react-slick

Why the last item is shown. I set it to centerMode: true

const App = () => {
  const settings = {
    dots: true,
    cssEase: 'linear',
    infinite: true,
    speed: 500,
    slidesToShow: 2,
    slidesToScroll: 2,
    centerMode: true,
  };

  return (
    <Fragment>
      <div className="text-center">
        <h2> Single Item</h2>
        <Slider {...settings}>
          <div>
            <h3>1</h3>
          </div>
          <div>
            <h3>2</h3>
          </div>
          <div>
            <h3>3</h3>
          </div>
          <div>
            <h3>4</h3>
          </div>
        </Slider>
      </div>
    </Fragment>
  );
};

All 5 comments

You have to set the initialSlide prop which indicates the index of the slide to start at.

initialSlide didn't work for me personally, but setting infinite: false worked

Does anyone solve it

infinite: false

yes it works, but I also need initialSlide=0 and infinite=true

I also need to use infinite=true and initialSlide=0, when i do use this config last slide is shown first

Was this page helpful?
0 / 5 - 0 ratings

Related issues

darkalor picture darkalor  路  4Comments

slashwhatever picture slashwhatever  路  3Comments

ramyatrouny picture ramyatrouny  路  3Comments

rohitgoyal7 picture rohitgoyal7  路  3Comments

enriquelopez-atlas picture enriquelopez-atlas  路  3Comments