diff --git a/seasonals/fireworks.css b/seasonals/fireworks.css index 5314a2b..aded202 100644 --- a/seasonals/fireworks.css +++ b/seasonals/fireworks.css @@ -1,15 +1,12 @@ .fireworks { - position: absolute; + position: fixed; + overflow: hidden; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; - - /* activate the following for fixed positioning */ - /*position: fixed;*/ - /*overflow: hidden;*/ } .rocket-trail { diff --git a/seasonals/fireworks.js b/seasonals/fireworks.js index 84ad087..15332cd 100644 --- a/seasonals/fireworks.js +++ b/seasonals/fireworks.js @@ -108,14 +108,6 @@ function createExplosion(x, y) { // Function for the firework with trail function launchFirework() { - const fireworkContainer = document.querySelector('.fireworks') || document.createElement("div"); - - if (!document.querySelector('.fireworks')) { - fireworkContainer.className = "fireworks"; - fireworkContainer.setAttribute("aria-hidden", "true"); - document.body.appendChild(fireworkContainer); - } - // Random horizontal position const x = Math.random() * window.innerWidth; // Any value across the entire width @@ -141,6 +133,14 @@ function launchFirework() { // Start the firework routine function startFireworks() { + const fireworkContainer = document.querySelector('.fireworks') || document.createElement("div"); + + if (!document.querySelector('.fireworks')) { + fireworkContainer.className = "fireworks"; + fireworkContainer.setAttribute("aria-hidden", "true"); + document.body.appendChild(fireworkContainer); + } + fireworksInterval = setInterval(() => { const randomCount = Math.floor(Math.random() * maxFireworks) + minFireworks; for (let i = 0; i < randomCount; i++) {