sundays/src/utils/config.js

17 lines
668 B
JavaScript
Raw Normal View History

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');
}
});
});
});
};