Compare commits
1 Commits
advanced
...
1cd76ef645
| Author | SHA1 | Date | |
|---|---|---|---|
| 1cd76ef645 |
@@ -1,12 +1,15 @@
|
|||||||
.fireworks {
|
.fireworks {
|
||||||
position: fixed;
|
position: absolute;
|
||||||
overflow: hidden;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
|
||||||
|
/* activate the following for fixed positioning */
|
||||||
|
/*position: fixed;*/
|
||||||
|
/*overflow: hidden;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.rocket-trail {
|
.rocket-trail {
|
||||||
|
|||||||
11
fireworks.js
11
fireworks.js
@@ -108,6 +108,9 @@ function createExplosion(x, y) {
|
|||||||
|
|
||||||
// Function for the firework with trail
|
// Function for the firework with trail
|
||||||
function launchFirework() {
|
function launchFirework() {
|
||||||
|
const fireworkContainer = document.querySelector('.fireworks');
|
||||||
|
if (!fireworkContainer) return;
|
||||||
|
|
||||||
// Random horizontal position
|
// Random horizontal position
|
||||||
const x = Math.random() * window.innerWidth; // Any value across the entire width
|
const x = Math.random() * window.innerWidth; // Any value across the entire width
|
||||||
|
|
||||||
@@ -133,14 +136,6 @@ function launchFirework() {
|
|||||||
|
|
||||||
// Start the firework routine
|
// Start the firework routine
|
||||||
function startFireworks() {
|
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(() => {
|
fireworksInterval = setInterval(() => {
|
||||||
const randomCount = Math.floor(Math.random() * maxFireworks) + minFireworks;
|
const randomCount = Math.floor(Math.random() * maxFireworks) + minFireworks;
|
||||||
for (let i = 0; i < randomCount; i++) {
|
for (let i = 0; i < randomCount; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user