akiran / akiran/react-slick

First slide delay when fade set to true

Abierto
#1,343 4 comentarios 2 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
11.9k
Forks
2.1k
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.