React-slick: Prevent change slide

Created on 30 Sep 2017  路  5Comments  路  Source: akiran/react-slick

Is there any way to prevent change slide?

I tried to catch beforeChange event and change state of slider to current slide but it doesn't help.

Also I tried to set initialSlide to catch if i lost mu curent index on rerender, but it doesn't help.

I had
initialSlide: this.refs.slider ? this.refs.slider.innerSlider.state.currentSlide : 1,
and on rerender it doesn't set to 1. It just go to 0 and I can do nothing with that/

question

Most helpful comment

@laveesingh Can we reopen this? I'd like the same functionality.

Discussion on the same topic on the main JS version here: https://github.com/kenwheeler/slick/pull/2104

All 5 comments

Closing as stale. If still facing any problem related to this. Please reopen with more details or perhaps a codesandbox demo.

@laveesingh Can we reopen this? I'd like the same functionality.

Discussion on the same topic on the main JS version here: https://github.com/kenwheeler/slick/pull/2104

I had this issue when trying to prevent keyboard left/right clicks from moving the slides. What I used was an onClick event and blur() in order to prevent.
handleClick(e) {
var target = e.target.closest('.slick-slide') || e.target
target.blur()
}

hope this helps!

@pbortnick I did something similar, but the ideal solution I think is to show an animation and have it 'bounce' back so the user is aware the action (prev/next) works but is not allowed to go to the next slide. In my situation it's a slider of form fields so you need to complete the current field before being allowed to move on to the next one.

@paulcredmond do you have realization of your idea?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quarklemotion picture quarklemotion  路  4Comments

amishPro picture amishPro  路  3Comments

eternalsky picture eternalsky  路  3Comments

enriquelopez-atlas picture enriquelopez-atlas  路  3Comments

walker-jiang picture walker-jiang  路  3Comments