From 0438e8c24ddd4b2914efd5f00453d6a6e0ca0220 Mon Sep 17 00:00:00 2001 From: Joan Mira Date: Tue, 24 May 2022 00:14:33 +0900 Subject: [PATCH] Update modal.js This change allows catching the element with the handler attached, rather than target any other child element. --- docs/js/modal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/js/modal.js b/docs/js/modal.js index 463543fd..05fac37d 100644 --- a/docs/js/modal.js +++ b/docs/js/modal.js @@ -16,7 +16,7 @@ let visibleModal = null; // Toggle modal const toggleModal = event => { event.preventDefault(); - const modal = document.getElementById(event.target.getAttribute('data-target')); + const modal = document.getElementById(event.currentTarget.getAttribute('data-target')); (typeof(modal) != 'undefined' && modal != null) && isModalOpen(modal) ? closeModal(modal) : openModal(modal) } @@ -92,4 +92,4 @@ const getScrollbarWidth = () => { // Is scrollbar visible const isScrollbarVisible = () => { return document.body.scrollHeight > screen.height; -} \ No newline at end of file +}