add div if
This commit is contained in:
@ -83,7 +83,13 @@ function addRandomSnowflakes(count) {
|
|||||||
|
|
||||||
// initialize standard snowflakes
|
// initialize standard snowflakes
|
||||||
function initSnowflakes() {
|
function initSnowflakes() {
|
||||||
const snowflakesContainer = document.querySelector('.snowflakes');
|
const snowflakesContainer = document.querySelector('.snowflakes') || document.createElement("div");
|
||||||
|
|
||||||
|
if (!document.querySelector('.snowflakes')) {
|
||||||
|
snowflakesContainer.className = "snowflakes";
|
||||||
|
snowflakesContainer.setAttribute("aria-hidden", "true");
|
||||||
|
document.body.appendChild(snowflakesContainer);
|
||||||
|
}
|
||||||
|
|
||||||
// Array of snowflake characters
|
// Array of snowflake characters
|
||||||
const snowflakeSymbols = ['❅', '❆'];
|
const snowflakeSymbols = ['❅', '❆'];
|
||||||
|
Reference in New Issue
Block a user