File size: 1,046 Bytes
cc1fb09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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'
            });
        });
    });
});