fixed x button on modal image

This commit is contained in:
gelonspr 2024-03-08 17:21:36 +08:00
parent 6cb4c0b4d2
commit a6f7b8cec0
1 changed files with 2 additions and 3 deletions

View File

@ -206,7 +206,6 @@ $BearerToken = $_SESSION['token'];
var modal = document.getElementById("myModal"); var modal = document.getElementById("myModal");
function trigger(var1, caption) { function trigger(var1, caption) {
var modalImg = document.getElementById("img01"); var modalImg = document.getElementById("img01");
@ -215,9 +214,9 @@ $BearerToken = $_SESSION['token'];
captionText.innerHTML = caption; captionText.innerHTML = caption;
} }
// Close the modal when clicking outside the image // Close the modal when clicking outside the image or x button
window.onclick = function(event) { window.onclick = function(event) {
if (event.target == modal) { if (event.target == modal || event.target.classList.contains('closeImg')) {
modal.style.display = "none"; modal.style.display = "none";
} }
} }