Moved configuration dialog scripts to its own file.
This commit is contained in:
parent
d58af9e138
commit
26a730c149
1 changed files with 17 additions and 0 deletions
17
src/utils/config.js
Normal file
17
src/utils/config.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
export const bindEvents = () => {
|
||||
document.querySelectorAll('a[data-click]').forEach((e) => {
|
||||
e.addEventListener('click', (evt) => {
|
||||
evt.preventDefault();
|
||||
const dialog = document.querySelector('dialog.'+e.getAttribute('data-click'));
|
||||
document.querySelector('#menu-toggle').checked = false;
|
||||
dialog?.classList.remove('hidden');
|
||||
dialog?.showModal();
|
||||
dialog?.addEventListener('click', (evt) => {
|
||||
if (evt.target === dialog) {
|
||||
dialog?.close();
|
||||
dialog?.classList.add('hidden');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
Loading…
Reference in a new issue