added minor fixes in modal image

This commit is contained in:
gelonspr 2024-03-08 10:54:54 +08:00
parent 833d35ad50
commit c9f8f1f0aa
1 changed files with 7 additions and 8 deletions

View File

@ -192,10 +192,10 @@
} }
} }
var captionText = document.getElementById("captionText"); var modal = document.getElementById("myModal");
function trigger(var1, caption) { function trigger(var1, caption) {
var modal = document.getElementById("myModal");
var modalImg = document.getElementById("img01"); var modalImg = document.getElementById("img01");
modal.style.display = "block"; modal.style.display = "block";
@ -203,13 +203,12 @@
captionText.innerHTML = caption; captionText.innerHTML = caption;
} }
var span = document.getElementsByClassName("close")[0]; // Close the modal when clicking outside the image
window.onclick = function(event) {
if (event.target == modal) {
function closeModal() {
var modal = document.getElementById("myModal");
modal.style.display = "none"; modal.style.display = "none";
} }
}
</script> </script>
<div class="modal fade" id="rejectModal" tabindex="-1" role="dialog" aria-labelledby="rejectModalLabel" aria-hidden="true"> <div class="modal fade" id="rejectModal" tabindex="-1" role="dialog" aria-labelledby="rejectModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">