Skip to content

Commit f25e7ea

Browse files
committed
css edited
1 parent 04dfc76 commit f25e7ea

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

ToastNotification/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ btn.addEventListener("click", () => {
3737
//unfilled form pop
3838
function fillForm() {
3939
let div = document.createElement("div");
40-
div.classList.add("msgSent");
41-
div.style.color = "red";
40+
div.classList.add("msg-not-sent");
4241
toastNotification.appendChild(div);
4342
div.innerHTML = `<span class="material-symbols-outlined"> check_circle </span> Please fill the form`;
4443
removeToast(div);
@@ -53,6 +52,7 @@ bookForm.addEventListener("submit", function (event) {
5352
emailjs.sendForm(serviceID, templateID, this).then(
5453
() => {
5554
toast();
55+
this.reset();
5656
},
5757
(err) => {
5858
alert(JSON.stringify(err));

ToastNotification/style.css

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,30 +81,43 @@ form button:active {
8181
flex-direction: column;
8282
gap: 20px;
8383
}
84-
.msgSent {
84+
.msgSent,
85+
.msg-not-sent {
8586
display: flex;
8687
height: 8vmin;
8788
justify-content: center;
8889
align-items: center;
8990
gap: 5px;
90-
color: green;
9191
font-weight: 900;
9292
border-radius: 20px;
9393
background-color: #e6e8e6;
9494
box-shadow: 0 0 5px;
9595
position: relative;
9696
overflow: hidden;
9797
}
98-
.msgSent:after {
98+
.msgSent {
99+
color: green;
100+
}
101+
.msg-not-sent {
102+
color: red;
103+
}
104+
105+
.msgSent:after,
106+
.msg-not-sent:after {
99107
content: "";
100108
position: absolute;
101109
bottom: 0;
102110
left: 0;
103-
background-color: black;
104111
width: 100%;
105112
height: 5px;
106113
animation: width 5s linear forwards;
107114
}
115+
.msg-not-sent:after {
116+
background-color: red;
117+
}
118+
.msgSent:after {
119+
background-color: green;
120+
}
108121
@keyframes width {
109122
to {
110123
width: 0;

0 commit comments

Comments
 (0)