akiran / akiran/react-slick

Trigger slider to recalculate slide widths after image loaded

Abierto
#1,900 0 comentarios 0 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

I'm looking for a way to get the slider to recalculate the slide widths after the images have loaded.

We are creating the contents of the slider based on results from an AJAX call, but the slide width is being calculated at `0px` because it happens before the image has finished loading.

If we listen for the image loaded event and then set the slides width to `auto` it forces the slider to recalculate the slides width, but not every time. Sometimes we are left with the width `auto` and this causes issues with the slides breaking onto a new row inside the slide.

Is there any reliable way to get the slider to recalculate the slides widths after an event?

Also mentioned in this issue: https://github.com/akiran/react-slick/issues/1884#issuecomment-699716131

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.