akiran / akiran/react-slick

Trigger slider to recalculate slide widths after image loaded

オープン
#1,900 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
11.9k
フォーク
2.1k
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。