-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
96 lines (81 loc) · 3.03 KB
/
script.js
File metadata and controls
96 lines (81 loc) · 3.03 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// iFlow Capital Analysis - Navigation & Interactions
document.addEventListener('DOMContentLoaded', function() {
// Smooth scroll navigation
initNavigation();
// Add subtle hover effects
initHoverEffects();
console.log('iFlow Capital Analysis loaded');
});
function initNavigation() {
const navLinks = document.querySelectorAll('.nav-link');
navLinks.forEach(link => {
link.addEventListener('click', function(e) {
const href = this.getAttribute('href');
if (href.startsWith('#')) {
e.preventDefault();
const target = document.querySelector(href);
if (target) {
const headerOffset = 80;
const elementPosition = target.getBoundingClientRect().top;
const offsetPosition = elementPosition + window.pageYOffset - headerOffset;
window.scrollTo({
top: offsetPosition,
behavior: 'smooth'
});
}
}
});
});
// Update active nav on scroll
window.addEventListener('scroll', updateActiveNav);
}
function updateActiveNav() {
const sections = document.querySelectorAll('section[id]');
const navLinks = document.querySelectorAll('.nav-link');
const scrollPosition = window.pageYOffset + 100;
sections.forEach(section => {
const sectionTop = section.offsetTop;
const sectionHeight = section.offsetHeight;
const sectionId = section.getAttribute('id');
if (scrollPosition >= sectionTop && scrollPosition < sectionTop + sectionHeight) {
navLinks.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href') === '#' + sectionId) {
link.classList.add('active');
}
});
}
});
}
function initHoverEffects() {
// Timeline items
document.querySelectorAll('.timeline-event').forEach(item => {
item.addEventListener('mouseenter', function() {
const marker = this.querySelector('.event-marker');
if (marker) {
marker.style.transform = 'scale(1.2)';
}
});
item.addEventListener('mouseleave', function() {
const marker = this.querySelector('.event-marker');
if (marker) {
marker.style.transform = 'scale(1)';
}
});
});
// Analysis cards
document.querySelectorAll('.analysis-card').forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-2px)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0)';
});
});
// Data tables rows
document.querySelectorAll('.full-table tbody tr').forEach(row => {
row.addEventListener('mouseenter', function() {
this.style.transition = 'background-color 0.2s ease';
});
});
}