1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul-website synced 2024-11-21 21:22:21 +00:00
strimertul-website/layouts/partials/image-modal.html
Ash Keel 828e2a89c0
All checks were successful
continuous-integration/drone/push Build is passing
move releases to website
2023-11-12 01:49:01 +01:00

30 lines
882 B
HTML

<div id="image-modal" class="modal">
<button class="modal-close" onclick="closeModal()">close</button>
<div class="modal-content">
<img
class="modal-pic"
id="modalPic"
onclick="closeModal()"
style="max-width: 100%; max-height: 80vh; margin: auto;"
/>
</div>
</div>
<script>
// Open the Modal
function openModal(clicked_id) {
var src = document.getElementById(clicked_id).src;
if (src.includes("#")) {
src = src.substring(0, src.indexOf("#"));
}
document.getElementById("modalPic").src = src;
document.getElementById("image-modal").style.display = "block";
}
// Close the Modal
function closeModal() {
// prevents flashing last modal image while new id is loading on open
document.getElementById("modalPic").src = "";
document.getElementById("image-modal").style.display = "none";
}
</script>