mirror of
https://github.com/picocss/pico.git
synced 2025-04-20 16: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
|
// Toggle modal
|
||||||
const toggleModal = event => {
|
const toggleModal = event => {
|
||||||
event.preventDefault();
|
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)
|
(typeof(modal) != 'undefined' && modal != null)
|
||||||
&& isModalOpen(modal) ? closeModal(modal) : openModal(modal)
|
&& isModalOpen(modal) ? closeModal(modal) : openModal(modal)
|
||||||
}
|
}
|
||||||
|
@ -92,4 +92,4 @@ const getScrollbarWidth = () => {
|
||||||
// Is scrollbar visible
|
// Is scrollbar visible
|
||||||
const isScrollbarVisible = () => {
|
const isScrollbarVisible = () => {
|
||||||
return document.body.scrollHeight > screen.height;
|
return document.body.scrollHeight > screen.height;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue