change order

This commit is contained in:
MLH
2024-12-21 01:58:49 +01:00
parent ad38ba12ed
commit 20da20daa9

View File

@@ -45,25 +45,6 @@ observer.observe(document.body, {
// Array of hearts characters // Array of hearts characters
const heartSymbols = ['❤️', '💕', '💞', '💓', '💗', '💖']; const heartSymbols = ['❤️', '💕', '💞', '💓', '💗', '💖'];
// create hearts objects
function createHearts() {
const container = document.querySelector('.hearts-container') || document.createElement("div");
if (!document.querySelector('.hearts-container')) {
container.className = "hearts-container";
container.setAttribute("aria-hidden", "true");
document.body.appendChild(container);
}
for (let i = 0; i < 12; i++) {
const heartsDiv = document.createElement("div");
heartsDiv.className = "heart";
heartsDiv.textContent = heartSymbols[i % heartSymbols.length];
container.appendChild(heartsDiv);
}
}
function addRandomSymbols(count) { function addRandomSymbols(count) {
const heartsContainer = document.querySelector('.hearts-container'); // get the hearts container const heartsContainer = document.querySelector('.hearts-container'); // get the hearts container
@@ -97,6 +78,25 @@ function addRandomSymbols(count) {
console.log('Random hearts symbols added'); console.log('Random hearts symbols added');
} }
// create hearts objects
function createHearts() {
const container = document.querySelector('.hearts-container') || document.createElement("div");
if (!document.querySelector('.hearts-container')) {
container.className = "hearts-container";
container.setAttribute("aria-hidden", "true");
document.body.appendChild(container);
}
for (let i = 0; i < 12; i++) {
const heartsDiv = document.createElement("div");
heartsDiv.className = "heart";
heartsDiv.textContent = heartSymbols[i % heartSymbols.length];
container.appendChild(heartsDiv);
}
}
// initialize hearts after the DOM is loaded // initialize hearts after the DOM is loaded
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {