mirror of
https://github.com/picocss/pico.git
synced 2025-04-23 01:46:14 -04:00
Update modal.js
This change allows catching the element with the handler attached, rather than target any other child element.
This commit is contained in:
parent
161dfa874d
commit
0438e8c24d
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue