File size: 1,603 Bytes
fa25a93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Main application scripts
document.addEventListener('DOMContentLoaded', function() {
    // Smooth scrolling for anchor links
    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener('click', function (e) {
            e.preventDefault();
            document.querySelector(this.getAttribute('href')).scrollIntoView({
                behavior: 'smooth'
            });
        });
    });

    // Animation triggers
    const animateOnScroll = () => {
        const elements = document.querySelectorAll('.animate-on-scroll');
        
        elements.forEach(element => {
            const elementPosition = element.getBoundingClientRect().top;
            const screenPosition = window.innerHeight / 1.3;
            
            if(elementPosition < screenPosition) {
                element.classList.add('animate-fade-in');
            }
        });
    };

    window.addEventListener('scroll', animateOnScroll);
    animateOnScroll(); // Run once on load
});

// Sample function to simulate loading test recommendations
function loadTestRecommendations() {
    // In a real app, this would fetch from an API
    return {
        essential: [
            "CBC (Complete Blood Count)",
            "Comprehensive Metabolic Panel",
            "Lipid Panel + ApoB",
            "HbA1c & Fasting Insulin",
            "Thyroid Function (TSH, Free T4)"
        ],
        specialty: [
            "Vitamin D (25-OH)",
            "hs-CRP (Inflammation)",
            "Hormone Panel",
            "Omega-3 Index",
            "Homocysteine"
        ]
    };
}