akiran / akiran/react-slick

Trigger slider to recalculate slide widths after image loaded

Đang mở
#1,900 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
11.9k
Fork
2.1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.