2

I am using react-slick and I am trying to find the solution to go to initial slide on clicking the last slide

I have tried adding afterChange,beforeChange and added slickGoto(0) if nextslide is equal to last-slide-num.Actually nothing happens I have gone through this... but that is not sufficient

const settings = {
      dots: false,
      infinite: false,
      autoplay: false,
      speed: 500,
      arrows: true,
      slidesToShow:2.7,
      beforeChange:(current,next) => {
      if(current === 2){
        this.slider.slickGoTo(0);
        }
      },
}

This is the setting

Expected should go to initial slide

Laczkó Örs
  • 1,082
  • 1
  • 18
  • 38
Rajat Rao
  • 191
  • 1
  • 10

1 Answers1

0

You can use this setting

infinite: true
David Jones
  • 2,879
  • 2
  • 18
  • 23
Boidurja Talukdar
  • 676
  • 2
  • 21
  • 42