ucdj-marvel / js-games

javascript games
0 stars 0 forks source link

本番環境で画像が途切れる問題の調査と修正 #17

Closed ucdj-marvel closed 2 years ago

ucdj-marvel commented 2 years ago
ucdj-marvel commented 2 years ago

ローカルでは普通に表示できているので読み込み速度の問題と仮定 参考記事

画像の事前読み込みで対応

ucdj-marvel commented 2 years ago

rel="preload"でページ読み込み前に画像の読み込み完了するように修正

<head>
  <link rel="stylesheet" type="text/css" href="static/css/fighting.css">
  <link href="static/image/craftpix/backgrounds/PNG/City1/Bright/City1.png" as="image" rel="preload">
  <link href="static/image/craftpix/characters/police/png/1/right/idle/1_police_Idle_000.png" as="image" rel="preload">