Skip to content

Commit

Permalink
feat: add form completion popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo Fernandez Teixeira committed Jul 4, 2024
1 parent c94ee3b commit df34229
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contato/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ <h1>Contato</h1>
<button type="submit">Submit</button>
</form>
<div id="successMessage" class="hidden">Thank you for contacting us!</div>
<div id="errorMessage" class="hidden">There was an error submitting the form. Please try again.</div>
<!-- Popup Modal -->

</div>
</div>
</div>
Expand Down
14 changes: 14 additions & 0 deletions contato/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,17 @@ document
document.getElementById("errorMessage").classList.add("visible");
}
});

// Script para fechar o modal
var modal = document.getElementById("successModal");
var span = document.getElementsByClassName("close")[0];

span.onclick = function () {
modal.style.display = "none";
};

window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
}
};
38 changes: 38 additions & 0 deletions contato/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,41 @@ button:hover {
label {
margin: 5px;
}

h1,
p,
a {
animation: appear 1s backwards;
}

.contact-form {
animation: appear 1s backwards;
}

h1 {
animation-delay: 0.2s;
}

p {
animation-delay: 0.8s;
}

a {
animation-delay: 1.6s;
}
.contact-form {
animation-delay: 0.5s;
background-color: rgba(245, 222, 179, 0.8);
}
/*
@media (width < 40rem) {
html {
font-size: 70%;
}
}
*/
@keyframes appear {
0% {
opacity: 0;
}
}

0 comments on commit df34229

Please sign in to comment.