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

Bug: variableWidth + infinite results in slides in wrong position...

Open binkydog opened this issue 10 years ago • 8 comments

Depending on the width of the container, you'll typically get the last slide showing up in the first position, or perhaps the second to last slide. Either way, it's not the first slide.

Also, if you turn off infinite, then it works fine. Only an issue when variableWidth and infinite enabled.

See this to reproduce: https://jsfiddle.net/a3azf02k/1/

binkydog avatar Nov 04 '16 16:11 binkydog

+1

vorobey avatar Nov 23 '16 14:11 vorobey

+1

I also get this same issue, and when I disable infinite I get the same problem while pressing the back arrow.

sloansparger avatar Dec 19 '16 01:12 sloansparger

Any updates on this?

miraage avatar Jan 13 '17 14:01 miraage

Having the same issue 😞

mikeelltt avatar Apr 01 '17 16:04 mikeelltt

By the way, if you resize the window after the page is loaded it gets fixed, maybe it could help in fixing the bug.

mikeelltt avatar Apr 01 '17 16:04 mikeelltt

Having the same issue. Adding initialSlide={1} seems to be a workaround.

PengyuanZhao avatar Jun 22 '17 13:06 PengyuanZhao

Another quick workaround for me was to do define a ref for the slider component, access innerSlide and call slickGoto(1):

componentDidMount() { setTimeout(() => { this.slider.innerSlider.slickGoTo(1); }, 0); }

Had to use zero setTimeout because I wanted to make sure that the slider gets fully initialised first.

Similarly you can call this.slider.innerSlider.slickNext().

samahndev avatar Dec 20 '17 23:12 samahndev

Similar problems have been fixed in previous releases. Please feel free to request reopen if disagree.

laveesingh avatar Mar 28 '18 11:03 laveesingh