// Ensure the code runs only after the Ecwid store is loaded
document.addEventListener("DOMContentLoaded", function () {
// Add a New Year's banner at the top of the store
const banner = document.createElement('div');
banner.style.position = 'fixed';
banner.style.top = '0';
banner.style.left = '0';
banner.style.width = '100%';
banner.style.backgroundColor = '#ffcc00';
banner.style.color = '#000';
banner.style.textAlign = 'center';
banner.style.padding = '10px 0';
banner.style.zIndex = '9999';
banner.style.fontFamily = 'Arial, sans-serif';
banner.style.fontSize = '20px';
banner.innerHTML = '🎉 Happy New Year! Celebrate with joy and color! 🎆';
document.body.appendChild(banner);
// Confetti effect
function createConfetti() {
const confettiCount = 100;
const confettiColors = ['#ff5733', '#ffcc00', '#33ff57', '#3375ff', '#cc33ff'];
for (let i = 0; i < confettiCount; i++) {
const confetti = document.createElement('div');
confetti.style.position = 'fixed';
confetti.style.width = '10px';
confetti.style.height = '10px';
confetti.style.backgroundColor = confettiColors[Math.floor(Math.random() * confettiColors.length)];
confetti.style.borderRadius = '50%';
confetti.style.top = '-50px';
confetti.style.left = Math.random() * window.innerWidth + 'px';
confetti.style.animation = `fall ${Math.random() * 3 + 2}s linear ${Math.random() * 2}s infinite`;
document.body.appendChild(confetti);
setTimeout(() => {
confetti.remove();
}, 5000);
}
}
// CSS for confetti animation
const style = document.createElement('style');
style.innerHTML = `
@keyframes fall {
0% { transform: translateY(0); opacity: 1; }
100% { transform: translateY(${window.innerHeight}px); opacity: 0; }
}
`;
document.head.appendChild(style);
// Continuously create confetti
setInterval(createConfetti, 1000);
// Add some festive styling to the store elements
const storeContainer = document.querySelector('#ecwid-store-container');
if (storeContainer) {
storeContainer.style.border = '5px solid #ffcc00';
storeContainer.style.borderRadius = '10px';
storeContainer.style.boxShadow = '0 0 15px rgba(255, 204, 0, 0.7)';
}
});