Skip to content

Commit

Permalink
Added open and close functionality for volunteer modal. (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliehabb authored Apr 11, 2024
1 parent 7d405ce commit c8cb9c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions js/modals.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

function toggleModal() {
let modal = document.querySelector("#volunteer-modal");
modal.classList.toggle("hidden");
}

//Opens the modal
document.querySelector(".volunteer-form-btn").addEventListener("click", toggleModal);

//Hides the modal
document.querySelector("#close-icon").addEventListener("click", toggleModal);

5 changes: 3 additions & 2 deletions pages/support-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<script type="module" src="/js/modals.mjs"></script>
</head>
<body>
<header class="flex h-24 items-center justify-between px-10 mt-6">
Expand Down Expand Up @@ -276,14 +277,14 @@ <h2 class="font-semibold text-2xl m-0">
</div>
<!-- Volunteer modal -->
<div
class="volunteer-modal flex justify-center items-center w-full h-full bg-[rgba(0,0,0,0.7)] absolute top-0 right-0 hidden"
class="volunteer-modal flex justify-center items-center w-full h-full bg-[rgba(0,0,0,0.7)] absolute top-0 right-0 hidden" id="volunteer-modal"
>
<!-- Not displayed(hidden) initially until volunteer-form-btn is clicked -->
<div
class="modal-content w-[1346px] h-[864px] bg-white flex flex-col items-center relative"
>
<i
class="fa-solid fa-x text-dark-green text-3xl ml-auto pt-8 pr-8 cursor-pointer absolute top-4 right-4"
class="fa-solid fa-x text-dark-green text-3xl ml-auto pt-8 pr-8 cursor-pointer absolute top-4 right-4" id="close-icon"
></i>
<!-- Add JS - close modal when clicking icon -->
<div
Expand Down

0 comments on commit c8cb9c0

Please sign in to comment.