| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize tooltips for color swatches | |
| const colorSwatches = document.querySelectorAll('.color-swatch'); | |
| colorSwatches.forEach(swatch => { | |
| const color = swatch.style.backgroundColor; | |
| swatch.setAttribute('title', color); | |
| swatch.addEventListener('click', function() { | |
| navigator.clipboard.writeText(color).then(() => { | |
| const originalText = swatch.textContent; | |
| swatch.textContent = 'Copied!'; | |
| setTimeout(() => { | |
| swatch.textContent = originalText; | |
| }, 2000); | |
| }); | |
| }); | |
| }); | |
| // Smooth scroll for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function(e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| }); |