Skip to content

Commit

Permalink
Modal events fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilchr committed Jul 5, 2023
1 parent 683748b commit 8841c2a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion resources/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ if (dateToday.getMonth() <= birthday.getMonth() && dateToday.getDate() <= birthd
}

document.getElementById('years-old').innerHTML = age; // Prints age to index.html
//contactModal.style.display === 'none';

// Contact modal
const contactPopUp = () => { // shows or hides contact modal
Expand All @@ -70,6 +69,7 @@ const contactPopUp = () => { // shows or hides contact modal

contactButton.addEventListener('click', contactPopUp);

// listens to the window and closes modal if clicks happen in the window but not on the button
window.onclick = (event) => {
if (!event.target.matches('.navigation-item')){
if (contactModal.classList.contains('show')) {
Expand All @@ -79,6 +79,9 @@ window.onclick = (event) => {
}
}

// disables event listener on the contact modal
contactModal.addEventListener('click', event => event.stopPropagation())

const colorPicture = () => {
profilePic.src = "./resources/images/emilbilde.png"
}
Expand Down

0 comments on commit 8841c2a

Please sign in to comment.