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

current slide incorrect value when infinite=false and slidesToShow > 1 #1809

Open
mgvez opened this issue May 27, 2020 · 3 comments
Open

current slide incorrect value when infinite=false and slidesToShow > 1 #1809

mgvez opened this issue May 27, 2020 · 3 comments

Comments

@mgvez
Copy link

mgvez commented May 27, 2020

When multiple slides are shown and that the slider cannot move left anymore, the current slide index does not change.

It seems that the state change that triggers animation uses the slide index to make the animation, and so does not change the value when animation is not possible. This is incorrect behaviour, as the clicked slide should be the current one, and not the leftmost visible slide.

This is a problem when using a thumbnail slider asNavFor a larger slider, as it makes it impossible to highlight the currently selected slide.

This affect the slick-current css class, as well as the beforeChange and afterChange events.

Example here CodeSandBox. To replicate, navigate to the last slides and click on any of the last ones. The red border is on .slick-current.

This probably also causes 1541

@dkadrios
Copy link

dkadrios commented May 28, 2020

I've been using this as a temporary hack (in react)

onInit={() => {
  setTimeout(() => { ref.current.slickGoTo(0) }, 750)
}}
ref={(slider) => { ref.current = slider }}

Way far from ideal but works in the meantime

@dkadrios
Copy link

Possible fix for this is in #1811

@aysegulkavaklii
Copy link

aysegulkavaklii commented Feb 5, 2024

+1

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

3 participants