From 5b1951b48ade86b49665c070169ed430272c728e Mon Sep 17 00:00:00 2001 From: Robert Jeutter Date: Tue, 7 Apr 2020 18:48:05 +0200 Subject: [PATCH] fixed bug that didn't close modal on X span --- js/cert.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/cert.js b/js/cert.js index 126d265..4220e9c 100644 --- a/js/cert.js +++ b/js/cert.js @@ -8,7 +8,12 @@ function myModalShowImg(picture) { } // When the user clicks on (x) or the picture, close the modal -var span = document.getElementsByClassName("close")[0] && document.getElementsByClassName("modal-content")[0]; +var span = document.getElementsByClassName("close")[0]; span.onclick = function () { modal.style.display = "none"; +}; + +var picture = document.getElementsByClassName("modal-content")[0]; +picture.onclick = function () { + modal.style.display = "none"; }; \ No newline at end of file