λ§μ CSS ν΄ν·μλ λͺ¨λ¬ λν μμλ₯Ό λ§λ€κΈ° μν μ€νμΌ(λ° μλ°μ€ν¬λ¦½νΈ)μ΄ ν¬ν¨λμ΄ μμ΅λλ€. μ΄ μλ λΆνΈμ€νΈλ©μμ μ 곡νλ μλ³Έ JavaScriptμ ν¨κ» HTMXλ₯Ό μ¬μ©νλ λ°©λ²μ 보μ¬μ€λλ€.
λ¨Όμ λν μμλ₯Ό νΈλ¦¬κ±°νλ λ²νΌκ³Ό λ§ν¬μ νλ¨μ λν μμκ° λ‘λλλ DIVκ° μμ΅λλ€:
<button
hx-get="/modal"
hx-target="#modals-here"
hx-trigger="click"
data-bs-toggle="modal"
data-bs-target="#modals-here"
class="btn primary">Open Modal</button>
<div id="modals-here"
class="modal modal-blur fade"
style="display: none"
aria-hidden="false"
tabindex="-1">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content"></div>
</div>
</div>
μ΄ λ²νΌμ ν΄λ¦νλ©΄ /modal
μ GET
μμ²μ 보λ
λλ€.
μλ΅μ λ΄μ©μ #modals-here
DIV μλμ DOMμ μΆκ°λ©λλ€.
μλ²λ λΆνΈμ€νΈλ©μ νμ€ λͺ¨λ¬μ μ½κ° μμ ν λ²μ μΌλ‘ μλ΅ν©λλ€.
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal title</h5>
</div>
<div class="modal-body">
<p>Modal body text goes here.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>