akiran / akiran/react-slick

First slide delay when fade set to true

Offen
#1,343 4 Kommentare 2 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 the `fade` setting is `true`, the current slide is only set after the time defined in `autoplaySpeed`.

Here is my configuration:
```
var settings = {
dots: false,
lazyLoad: true,
infinite: true,
autoplay: true,
fade: true,
speed: 1000,
autoplaySpeed: 4000,
arrows: false,
}
```
By inspecting the DOM, I can verify that no slider is set as `slick-current` until the time elapsed in the configuration. Since all sliders have `opacity:0` and no current is selected, the slider does not show any images when loaded.

As a quick hack to prevent an empty slider, I force the opacity of the first slide.
```
.slick-track {
.slick-slide:first-child {
opacity: 1 !important;
}
}
```
This is less than ideal since on load, the first slide displays for twice the time as other slides.

Thanks.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

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