-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtabs.js
More file actions
262 lines (223 loc) · 9.61 KB
/
Copy pathtabs.js
File metadata and controls
262 lines (223 loc) · 9.61 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/**
* tabs.js - Handles tab functionality and other UI interactions
*/
// Team section tabs functionality - Simplified version
function initTeamTabs() {
const tabButtons = document.querySelectorAll('.tab-btn');
const tabContents = document.querySelectorAll('.tab-content');
const searchContainers = document.querySelectorAll('.search-container');
// Hide search container in core team tab by default
const coreTeamSearch = document.querySelector('#core-team .search-container');
if (coreTeamSearch) {
coreTeamSearch.style.display = 'none';
}
tabButtons.forEach(button => {
button.addEventListener('click', () => {
// Remove active class from all buttons and contents
tabButtons.forEach(btn => btn.classList.remove('active'));
tabContents.forEach(content => content.classList.remove('active'));
// Add active class to clicked button and corresponding content
button.classList.add('active');
const tabId = button.getAttribute('data-tab');
const activeContent = document.getElementById(tabId);
activeContent.classList.add('active');
// Show/hide search container based on tab
searchContainers.forEach(container => {
container.style.display = tabId === 'execoms' ? 'block' : 'none';
});
// Clear search when switching tabs
const searchInputs = document.querySelectorAll('.search-input');
searchInputs.forEach(input => {
input.value = '';
input.dispatchEvent(new Event('input'));
});
// Handle Meet More Team Members button visibility
const expandBtn = document.getElementById('expandSectionBtn');
if (expandBtn) {
expandBtn.style.display = tabId === 'core-team' ? 'inline-flex' : 'none';
}
});
});
// Initialize first tab as active if none is active
if (!document.querySelector('.tab-btn.active') && tabButtons.length > 0) {
tabButtons[0].click();
}
}
// About section scroll animation
function initAboutAnimation() {
const aboutObserver = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add("scroll-reveal");
}
});
}, { threshold: 0.3 });
const aboutTarget = document.querySelector(".content-left");
if (aboutTarget) {
aboutObserver.observe(aboutTarget);
}
}
// Family section scroll animations
function initFamilyAnimations() {
const observerOptions = {
root: null,
rootMargin: '0px',
threshold: 0.1
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('scroll-reveal');
}
});
}, observerOptions);
// Observe all team sections
document.querySelectorAll('.testimonial-outer, .card, .testimonial-container, .member-list-container').forEach(el => {
observer.observe(el);
});
}
// Event timeline scroll animation
function initEventAnimations() {
const eventObserver = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add('show');
}
});
});
document.querySelectorAll('.event-timeline-item').forEach(el => {
eventObserver.observe(el);
});
}
function initTeamSearch() {
const searchInputs = document.querySelectorAll('.search-input');
const searchButtons = document.querySelectorAll('.search-button');
const suggestionsContainers = document.querySelectorAll('.search-suggestions');
const memberLists = document.querySelectorAll('.name-grid span, .team-heads .members span');
searchInputs.forEach((searchInput, index) => {
const suggestionsContainer = suggestionsContainers[index];
// Show suggestions while typing
searchInput.addEventListener('input', function (e) {
const searchTerm = e.target.value.toLowerCase();
suggestionsContainer.innerHTML = '';
if (searchTerm.length > 0) {
const matches = Array.from(memberLists).filter(member =>
member.textContent.toLowerCase().includes(searchTerm)
);
if (matches.length > 0) {
matches.forEach(match => {
const suggestion = document.createElement('div');
suggestion.className = 'suggestion-item';
suggestion.textContent = match.textContent;
// Click suggestion to fill search and highlight member
suggestion.addEventListener('click', () => {
searchInput.value = match.textContent;
suggestionsContainer.classList.remove('active');
// Remove any existing highlights
memberLists.forEach(m => m.classList.remove('member-highlight'));
// Add highlight to the selected member
match.classList.add('member-highlight');
// Scroll to the member with smooth behavior
match.scrollIntoView({
behavior: 'smooth',
block: 'center'
});
});
suggestionsContainer.appendChild(suggestion);
});
suggestionsContainer.classList.add('active');
} else {
suggestionsContainer.classList.remove('active');
}
} else {
suggestionsContainer.classList.remove('active');
// Remove highlights when search is cleared
memberLists.forEach(m => m.classList.remove('member-highlight'));
}
});
// Hide suggestions when clicking outside
document.addEventListener('click', (e) => {
if (!e.target.closest('.search-container')) {
suggestionsContainer.classList.remove('active');
}
});
// Hide suggestions on Enter key
searchInput.addEventListener('keydown', function (e) {
if (e.key === 'Enter') {
suggestionsContainer.classList.remove('active');
}
});
});
// Clear search when switching tabs
const tabButtons = document.querySelectorAll('.tab-btn');
tabButtons.forEach(button => {
button.addEventListener('click', () => {
searchInputs.forEach(input => {
input.value = '';
input.dispatchEvent(new Event('input'));
});
suggestionsContainers.forEach(container => {
container.classList.remove('active');
});
memberLists.forEach(m => m.classList.remove('member-highlight'));
});
});
}
// Initialize all UI interactions
document.addEventListener('DOMContentLoaded', () => {
initTeamTabs();
initAboutAnimation();
initFamilyAnimations();
initEventAnimations();
initTeamSearch();
});
// Tab switching functionality
document.addEventListener('DOMContentLoaded', function () {
// Get all tab buttons and content
const tabButtons = document.querySelectorAll('.tab-btn');
const tabContents = document.querySelectorAll('.tab-content');
// Add click event listeners to tab buttons
tabButtons.forEach(button => {
button.addEventListener('click', () => {
// Remove active class from all buttons and contents
tabButtons.forEach(btn => btn.classList.remove('active'));
tabContents.forEach(content => content.classList.remove('active'));
// Add active class to clicked button and corresponding content
button.classList.add('active');
const tabId = button.getAttribute('data-tab');
document.getElementById(tabId).classList.add('active');
});
});
// Expand button functionality
const expandBtn = document.getElementById('expandSectionBtn');
const additionalSection = document.getElementById('additionalSection');
const teamTabBtn = document.querySelector('[data-tab="execoms"]');
const coreTabBtn = document.querySelector('[data-tab="core-team"]');
if (expandBtn && additionalSection && teamTabBtn && coreTabBtn) {
// Only show button when in core team tab
function updateButtonVisibility() {
if (coreTabBtn.classList.contains('active')) {
expandBtn.style.display = 'inline-flex';
} else {
expandBtn.style.display = 'none';
}
}
// Initial visibility check
updateButtonVisibility();
// Update visibility when tabs change
document.querySelectorAll('.tab-btn').forEach(btn => {
btn.addEventListener('click', updateButtonVisibility);
});
expandBtn.addEventListener('click', function () {
// Switch to team tab
teamTabBtn.click();
// Hide the button after switching tabs
expandBtn.style.display = 'none';
// Scroll to the top of the team tab content
const teamTabContent = document.querySelector('.card');
if (teamTabContent) {
teamTabContent.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
});
}
});