Skip to content

Commit

Permalink
bugFix for form submit firecrackers
Browse files Browse the repository at this point in the history
  • Loading branch information
aakashdinkarh committed Nov 14, 2024
1 parent 7ccbfd6 commit 124c1a2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ <h2>Contact Me</h2>
<input type="email" placeholder="Your Email" name="user_email" required />
<textarea placeholder="Your Feedback/Message/Query" cols="30" rows="5" name="user_message" required></textarea>
<div class="m-justify-center">
<button class="styled-btn" type="submit">
<button class="styled-btn submit-btn" type="submit">
<span class="button-text color-black">Send Me</span>
</button>
</div>
Expand Down
3 changes: 0 additions & 3 deletions scripts/dynamicallyLoadChunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,4 @@ intersectionObserver('#project', () => {

intersectionObserver('#contact', () => {
loadJs('scripts/emailjs.js');

const footerCanvas = document.querySelector('canvas#fireworksFooter');
createFooterFirework = getFirework(footerCanvas);
});
15 changes: 9 additions & 6 deletions scripts/emailjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@
submitButton.disabled = true;

const emailCallback = (success = true) => {
let createFooterFirework = () => {};
if (getFirework) {
const footerFireworkCanvas = document.querySelector('canvas#fireworksFooter');
createFooterFirework = getFirework(footerFireworkCanvas);
}
if (success) {
emailCallback(true);
document.querySelector('section#home').addEventListener('click', () => {
setTimeout(createHomeFirework, 0);
setTimeout(createHomeFirework, 100);
setTimeout(createHomeFirework, 200);
});
setTimeout(createFooterFirework, 0);
setTimeout(createFooterFirework, 100);
setTimeout(createFooterFirework, 200);
}
form.classList.remove('loading');
buttonTextElement.innerText = success ? 'Sent ✅' : 'Failed ❌';
setTimeout(() => {
buttonTextElement.innerText = 'Send Me';
submitButton.disabled = false;
form.reset();
}, 2000);
};

Expand Down
4 changes: 4 additions & 0 deletions styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ section .text-content {
box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.4);
}
}
.styled-btn.submit-btn:hover {
transform: none;
cursor: pointer;
}
.color-black, a.color-black {
text-decoration: none;
color: var(--primary-bg-color);
Expand Down

0 comments on commit 124c1a2

Please sign in to comment.