HTMLify
script.js
Views: 20 | Author: karbonsites
1 | document.addEventListener('DOMContentLoaded', () => { const hamburger = document.querySelector('.hamburger'); const navLinks = document.querySelector('.nav-links'); if (hamburger && navLinks) { hamburger.addEventListener('click', () => { navLinks.style.display = navLinks.style.display === 'flex' ? 'none' : 'flex'; if (navLinks.style.display === 'flex') { navLinks.style.flexDirection = 'column'; navLinks.style.position = 'absolute'; navLinks.style.top = '80px'; navLinks.style.left = '0'; navLinks.style.width = '100%'; navLinks.style.background = 'var(--surface-color)'; navLinks.style.padding = '2rem'; navLinks.style.borderBottom = '1px solid var(--surface-border)'; navLinks.style.zIndex = '999'; } }); } const addToCartButtons = document.querySelectorAll('.add-to-cart'); addToCartButtons.forEach(button => { button.addEventListener('click', (e) => { const productName = e.target.getAttribute('data-product'); const originalText = e.target.textContent; e.target.textContent = 'Added to Cart!'; e.target.style.background = '#10b981'; setTimeout(() => { e.target.textContent = originalText; e.target.style.background = ''; }, 2000); alert(`🎉 Success! You have selected: ${productName}\nMade by God's power - Your order is securely logged!`); }); }); }); |