Add checks for container presence in animation functions to prevent errors when elements are removed from the DOM [skip ci]

This commit is contained in:
CodeDevMLH
2026-02-27 04:07:29 +01:00
parent 3c1bd01373
commit bd8088c52b
10 changed files with 20 additions and 15 deletions

View File

@@ -162,6 +162,7 @@ function startFireworks() {
}
fireworksInterval = setInterval(() => {
if (!document.body.contains(fireworkContainer)) { clearInterval(fireworksInterval); return; }
const randomCount = Math.floor(Math.random() * maxFireworks) + minFireworks;
for (let i = 0; i < randomCount; i++) {
setTimeout(() => {