Skip to content

Commit 0438e8c

Browse files
authored
Update modal.js
This change allows catching the element with the handler attached, rather than target any other child element.
1 parent 161dfa8 commit 0438e8c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/js/modal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let visibleModal = null;
1616
// Toggle modal
1717
const toggleModal = event => {
1818
event.preventDefault();
19-
const modal = document.getElementById(event.target.getAttribute('data-target'));
19+
const modal = document.getElementById(event.currentTarget.getAttribute('data-target'));
2020
(typeof(modal) != 'undefined' && modal != null)
2121
&& isModalOpen(modal) ? closeModal(modal) : openModal(modal)
2222
}
@@ -92,4 +92,4 @@ const getScrollbarWidth = () => {
9292
// Is scrollbar visible
9393
const isScrollbarVisible = () => {
9494
return document.body.scrollHeight > screen.height;
95-
}
95+
}

0 commit comments

Comments
 (0)