File size: 2,935 Bytes
d9ec865
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
67
68
69
70
71
72
73
74
75
76
77
78
79
document.addEventListener('DOMContentLoaded', function() {
    // Mobile menu toggle
    const mobileMenuButton = document.getElementById('mobile-menu-button');
    const mobileMenu = document.createElement('div');
    
    mobileMenu.id = 'mobile-menu';
    mobileMenu.className = 'mobile-menu fixed inset-y-0 right-0 w-64 bg-white shadow-lg z-50 p-6';
    mobileMenu.innerHTML = `
        <div class="flex justify-between items-center mb-8">
            <h2 class="text-xl font-bold text-primary-600">Menu</h2>
            <button id="close-mobile-menu">
                <i data-feather="x"></i>
            </button>
        </div>
        <nav>
            <ul class="space-y-4">
                <li><a href="#extension" class="block py-2 hover:text-primary-600 transition-colors">Extension</a></li>
                <li><a href="#software" class="block py-2 hover:text-primary-600 transition-colors">Software</a></li>
                <li><a href="#features" class="block py-2 hover:text-primary-600 transition-colors">Features</a></li>
            </ul>
        </nav>
    `;
    
    document.body.appendChild(mobileMenu);
    
    mobileMenuButton.addEventListener('click', function() {
        mobileMenu.classList.add('active');
        feather.replace();
        
        document.getElementById('close-mobile-menu').addEventListener('click', function() {
            mobileMenu.classList.remove('active');
        });
    });
    
    // Close mobile menu when clicking on a link
    const mobileLinks = mobileMenu.querySelectorAll('a');
    mobileLinks.forEach(link => {
        link.addEventListener('click', function() {
            mobileMenu.classList.remove('active');
        });
    });
    
    // Smooth scroll for all links with hashes
    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener('click', function(e) {
            e.preventDefault();
            
            const targetId = this.getAttribute('href');
            if (targetId === '#') return;
            
            const targetElement = document.querySelector(targetId);
            if (targetElement) {
                targetElement.scrollIntoView({
                    behavior: 'smooth'
                });
            }
        });
    });
    
    // Feather icons replacement
    feather.replace();
    
    // Animation on scroll
    const animateOnScroll = function() {
        const elements = document.querySelectorAll('.feature-card, section[id]');
        
        elements.forEach(element => {
            const elementPosition = element.getBoundingClientRect().top;
            const windowHeight = window.innerHeight;
            
            if (elementPosition < windowHeight - 100) {
                element.classList.add('animate-fadeIn');
            }
        });
    };
    
    window.addEventListener('scroll', animateOnScroll);
    animateOnScroll(); // Run once on page load
});