akiran / akiran/react-slick

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

Offen
#1,809 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
11.9k
Forks
2.1k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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](https://codesandbox.io/embed/react-slick-playground-11rg7?fontsize=14&hidenavigation=1&theme=dark). 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](https://github.com/akiran/react-slick/issues/1541)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.