Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slickNext() and slickPrev() not behaving correctly when initialSlide is > 0 and infinite is false #2140

Closed
david98 opened this issue Mar 8, 2022 · 1 comment

Comments

@david98
Copy link

david98 commented Mar 8, 2022

Basically, as the title says, if you create a slider with the following options:

var settings = {
  infinite: false,
  initialSlide: 2  // any value that is not 0 will still cause this problem
};

The slider correctly displays the slide at index 2, but the first call to slickNext() (either through the arrows or via code) will show slide 1 and the first call to slickPrev() will show slide 0. It looks like internally the slider object still thinks it's displaying index 0 even though initialSlide is set to a different value. This is supported by the fact that calling slickGoTo(2) once after page render completely solves the issue (that is, subsequent calls to slickNext() and slickPrev() behave as they should).

CodeSandbox: https://codesandbox.io/s/initial-slide-issue-qjhzxd?file=/index.js

@david98 david98 closed this as completed Mar 8, 2022
@david98 david98 reopened this Mar 8, 2022
@david98
Copy link
Author

david98 commented Mar 8, 2022

I just found this issue: #1946, so I will close mine as it's an exact duplicate.

@david98 david98 closed this as completed Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant