Skip to content

Commit

Permalink
Fix fireworks effects
Browse files Browse the repository at this point in the history
  • Loading branch information
MXJosueDev committed Dec 19, 2024
1 parent c245d27 commit 771ae35
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions assets/js/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,29 @@ document.addEventListener('DOMContentLoaded', function () {

function countdown() {
const currentDate = new Date();
const eventDate = new Date(`${currentDate.getFullYear()}-12-25T00:00:00`);
const eventDate = new Date(
`${currentDate.getFullYear()}-12-25T00:00:00`
);
// const eventDate = new Date(
// `${currentDate.getFullYear()}-12-18T09:44:00`
// `${currentDate.getFullYear()}-12-18T21:34:30`
// );

if (eventDate <= currentDate) {
countdownWrapper.classList.add('happy');
happyWrapper.classList.add('happy');

if (((currentDate - eventDate) / 1000) <= 30) {
if ((currentDate - eventDate) / 1000 <= 30) {
fireworksWrapper.onanimationend = () => {};
fireworksWrapper.onanimationiteration = () => {};

fireworksWrapper.style.display = 'block';
} else if (fireworksWrapper.style.display === 'block') {
fireworksWrapper.style.display = 'none';
fireworksWrapper.onanimationiteration = () => {
fireworksWrapper.style.display = 'none';
};
fireworksWrapper.onanimationend = () => {
fireworksWrapper.style.display = 'none';
};
}
return;
}
Expand Down

0 comments on commit 771ae35

Please sign in to comment.