From 1c8e97bb03c82bc84ef664922ed0d6d20fbd911c Mon Sep 17 00:00:00 2001 From: CodeDevMLH Date: Sat, 21 Dec 2024 02:09:36 +0100 Subject: [PATCH] switched to class instead of id for container --- snowfall.js | 10 +++++++++- test-site.html | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/snowfall.js b/snowfall.js index 12b0c09..c9c55b2 100644 --- a/snowfall.js +++ b/snowfall.js @@ -42,7 +42,15 @@ observer.observe(document.body, { function createSnowflakes() { - const container = document.getElementById('snowfall'); + const container = document.querySelector('.snowfall') || document.createElement("div"); + + if (!document.querySelector('.snowfall')) { + container.className = "snowfall"; + container.setAttribute("aria-hidden", "true"); + document.body.appendChild(container); + } + + const windowWidth = window.innerWidth; const windowHeight = window.innerHeight; diff --git a/test-site.html b/test-site.html index bf7984b..499ef44 100644 --- a/test-site.html +++ b/test-site.html @@ -15,7 +15,7 @@ -
+