Skip to content

Commit

Permalink
Merge pull request #3 from crooks-s/fix/add-handle-click
Browse files Browse the repository at this point in the history
add handleOnClick function to close overlay
  • Loading branch information
dustinusey authored Apr 18, 2024
2 parents be4d009 + fc47753 commit 171b178
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
const overlay = document.getElementById("overlay");
const login = document.getElementById("login");
const overlayCloseBtn = document.querySelector(".group p:last-of-type");

login.addEventListener("click", () => {
overlay.style.display = "grid";
});
function handleOnClick(event) {
if (event.target === login) {
overlay.style.display = "grid";
} else if (event.target === overlayCloseBtn) {
overlay.style.display = "none";
}
}

login.addEventListener("click", handleOnClick);
overlay.addEventListener("click", handleOnClick);

0 comments on commit 171b178

Please sign in to comment.