File size: 2,233 Bytes
aa6ddc7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Main JavaScript functionality
document.addEventListener('DOMContentLoaded', () => {
    // Animation for section headers
    const sectionHeaders = document.querySelectorAll('section h2');
    
    const observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('animate-fadeInUp');
            }
        });
    }, { threshold: 0.1 });
    
    sectionHeaders.forEach(header => {
        observer.observe(header);
    });

    // Tooltips for technology icons
    const tooltipElements = document.querySelectorAll('[data-tooltip]');
    tooltipElements.forEach(el => {
        el.addEventListener('mouseenter', showTooltip);
        el.addEventListener('mouseleave', hideTooltip);
    });

    function showTooltip(e) {
        const tooltip = document.createElement('div');
        tooltip.className = 'absolute bg-gray-900 text-white text-xs px-2 py-1 rounded whitespace-nowrap z-50';
        tooltip.textContent = e.target.dataset.tooltip;
        document.body.appendChild(tooltip);
        
        const rect = e.target.getBoundingClientRect();
        tooltip.style.top = `${rect.top - 30}px`;
        tooltip.style.left = `${rect.left + rect.width / 2 - tooltip.offsetWidth / 2}px`;
        
        e.target.dataset.tooltipId = tooltip;
    }

    function hideTooltip(e) {
        if (e.target.dataset.tooltipId) {
            document.body.removeChild(e.target.dataset.tooltipId);
            delete e.target.dataset.tooltipId;
        }
    }
});

// Add custom animation classes to Tailwind
if (typeof tailwind !== 'undefined') {
    tailwind.config = {
        ...tailwind.config,
        theme: {
            ...tailwind.config.theme,
            extend: {
                ...tailwind.config.theme.extend,
                animation: {
                    fadeInUp: 'fadeInUp 0.5s ease-out forwards'
                },
                keyframes: {
                    fadeInUp: {
                        '0%': { opacity: 0, transform: 'translateY(20px)' },
                        '100%': { opacity: 1, transform: 'translateY(0)' }
                    }
                }
            }
        }
    };
}