File size: 3,023 Bytes
b414b30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
80
81
82
// 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'
        });
    });
});

// Active navigation highlighting
window.addEventListener('scroll', () => {
    const sections = document.querySelectorAll('section');
    const navLinks = document.querySelectorAll('nav a');
    
    let current = '';
    sections.forEach(section => {
        const sectionTop = section.offsetTop;
        const sectionHeight = section.clientHeight;
        if (pageYOffset >= (sectionTop - 100)) {
            current = section.getAttribute('id');
        }
    });
    
    navLinks.forEach(link => {
        link.classList.remove('active');
        if (link.getAttribute('href') === `#${current}`) {
            link.classList.add('active');
        }
    });
});
// Dynamic project content loader
document.addEventListener('DOMContentLoaded', () => {
    const urlParams = new URLSearchParams(window.location.search);
    const projectId = urlParams.get('project');
    
    if (projectId && document.querySelector('#project-content')) {
        // In a real app, you would fetch project data from an API
        // This is just a placeholder for the demo
        const projects = {
            '1': {
                title: 'Quantum Simulation',
                description: 'Advanced quantum computing simulations using Qiskit framework',
                category: 'Quantum Computing',
                date: 'May 2023',
                technologies: ['Python', 'Qiskit', 'Quantum']
            },
            '2': {
                title: 'Neural Networks',
                description: 'Deep learning models for medical image analysis',
                category: 'Artificial Intelligence',
                date: 'March 2023',
                technologies: ['Python', 'TensorFlow', 'AI']
            },
            '3': {
                title: 'Research Portal',
                description: 'Platform for academic collaboration and paper sharing',
                category: 'Web Development',
                date: 'January 2023',
                technologies: ['React', 'Node.js', 'MongoDB']
            }
        };
        
        const project = projects[projectId];
        if (project) {
            document.title = `${project.title} | Quantum Coder Nexus`;
            document.querySelector('#project-title').textContent = project.title;
            document.querySelector('#project-description').textContent = project.description;
            // Update other elements similarly...
        }
    }
});

// Form submission handler
const contactForm = document.querySelector('form');
if (contactForm) {
    contactForm.addEventListener('submit', (e) => {
        e.preventDefault();
        alert('Thank you for your message! I will get back to you soon.');
        contactForm.reset();
    });
}