Merge pull request #304 from DutsAndrew/main
removed duplicate element selector & added semicolon
This commit is contained in:
commit
8891e00fe8
|
@ -1,13 +1,12 @@
|
||||||
const openButton = document.getElementById('trigger-modal');
|
const openButton = document.getElementById('trigger-modal');
|
||||||
const closeButton = document.getElementById('close-modal');
|
const closeButton = document.getElementById('close-modal');
|
||||||
const backdrop = document.getElementById('backdrop')
|
|
||||||
|
|
||||||
function toggleModal() {
|
function toggleModal() {
|
||||||
const modalDiv = document.querySelector('.popup-modal');
|
const modalDiv = document.querySelector('.popup-modal');
|
||||||
const backdrop = document.querySelector('.backdrop')
|
const backdrop = document.querySelector('.backdrop');
|
||||||
modalDiv.classList.toggle('show');
|
modalDiv.classList.toggle('show');
|
||||||
backdrop.classList.toggle('show');
|
backdrop.classList.toggle('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
openButton.addEventListener('click', toggleModal);
|
openButton.addEventListener('click', toggleModal);
|
||||||
closeButton.addEventListener('click', toggleModal);
|
closeButton.addEventListener('click', toggleModal);
|
Loading…
Reference in New Issue