Trainees

document.addEventListener(“DOMContentLoaded”, () => { document.querySelectorAll(“.shuffled-gallery”).forEach(gallery => { const items = Array.from(gallery.children) .filter(el => el.classList.contains(“wp-block-image”)); for (let i = items.length – 1; i > 0; i–) { const j = Math.floor(Math.random() * (i + 1)); [items[i], items[j]] = [items[j], items[i]]; } items.forEach(item => gallery.appendChild(item)); }); }); document.addEventListener(“DOMContentLoaded”, () => { document.querySelectorAll(“.shuffled-gallery”).forEach(gallery => { const items = Array.from(gallery.children) .filter(el => el.classList.contains(“wp-block-image”)); for (let i = items.length – 1; i > 0; i–) { const j = Math.floor(Math.random() * (i + 1)); [items[i], items[j]] = [items[j], items[i]]; } items.forEach(item => gallery.appendChild(item)); }); });