简体   繁体   English

React-Slick SlickGoTo 实现不起作用

[英]React-Slick SlickGoTo implementation not working

I am using react-slick and I am trying to find the solution to go to initial slide on clicking the last slide我正在使用 react-slick,我正在尝试找到 go 的解决方案,以在单击最后一张幻灯片时进行初始幻灯片

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我已经尝试添加afterChangebeforeChange并添加slickGoto(0)如果nextslide等于last-slide-num.Actually没有任何反应我已经经历了这个......但这还不够

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预计应该 go 到初始幻灯片

You can use this setting您可以使用此设置

infinite: true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM