akiran / akiran/react-slick

First slide delay when fade set to true

Aperta
#1,343 4 commenti 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
11.9k
Fork
2.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.