Trigger slider to recalculate slide widths after image loaded
- Dominant language
- JavaScript
- Stars
- 11.9k
- Forks
- 2.1k
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
Assessment
This issue has not been assessed yet.