Lazy Loading

이 μ˜ˆλŠ” νŽ˜μ΄μ§€μ—μ„œ μš”μ†Œλ₯Ό 느리게 λ‘œλ“œν•˜λŠ” 방법을 λ³΄μ—¬μ€λ‹ˆλ‹€.
λ‹€μŒκ³Ό 같은 초기 μƒνƒœλ‘œ μ‹œμž‘ν•©λ‹ˆλ‹€:

<div hx-get="/graph" hx-trigger="load">
  <img  alt="Result loading..." class="htmx-indicator" width="150" src="/img/bars.svg"/>
</div>

κ·Έλž˜ν”„λ₯Ό λ‘œλ“œν•˜λŠ” λ™μ•ˆ 진행λ₯  ν‘œμ‹œκΈ°κ°€ ν‘œμ‹œλ©λ‹ˆλ‹€.
그런 λ‹€μŒ μ•ˆμ •λœ CSS μ „ν™˜μ„ 톡해 μ‹œμ•Όμ—μ„œ λΆ€λ“œλŸ½κ²Œ 사라지며 κ·Έλž˜ν”„κ°€ λ‘œλ“œλ˜κ³  ν‘œμ‹œλ©λ‹ˆλ‹€:

.htmx-settling img {
  opacity: 0;
}
img {
 transition: opacity 300ms ease-in;
}
Server Requests ↑ Show

πŸ”—Demo