-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
232 lines (195 loc) · 6.25 KB
/
script.js
File metadata and controls
232 lines (195 loc) · 6.25 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
// ==================== //
// Navigation Functionality
// ==================== //
// Mobile menu toggle
const mobileMenuToggle = document.getElementById('mobile-menu-toggle');
const navLinks = document.querySelector('.nav-links');
mobileMenuToggle.addEventListener('click', () => {
mobileMenuToggle.classList.toggle('active');
navLinks.classList.toggle('active');
});
// Close mobile menu when clicking a link
document.querySelectorAll('.nav-link').forEach(link => {
link.addEventListener('click', () => {
mobileMenuToggle.classList.remove('active');
navLinks.classList.remove('active');
});
});
// ==================== //
// Smooth Scrolling & Active Nav
// ==================== //
const navbar = document.getElementById('navbar');
const sections = document.querySelectorAll('section[id]');
const navLinksArray = document.querySelectorAll('.nav-link');
// Add scrolled class to navbar
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
navbar.classList.add('scrolled');
} else {
navbar.classList.remove('scrolled');
}
// Update active navigation link
let current = '';
sections.forEach(section => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (window.scrollY >= sectionTop - 100) {
current = section.getAttribute('id');
}
});
navLinksArray.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href') === `#${current}`) {
link.classList.add('active');
}
});
});
// ==================== //
// Form Handling
// ==================== //
const registrationForm = document.getElementById('registrationForm');
registrationForm.addEventListener('submit', (e) => {
e.preventDefault();
// Get form data
const formData = new FormData(registrationForm);
const data = Object.fromEntries(formData);
// Here you would normally send the data to a server
console.log('Form submitted with data:', data);
// Show success message
showNotification('Thank you! We will notify you when registration opens.', 'success');
// Reset form
registrationForm.reset();
});
// ==================== //
// Notification System
// ==================== //
function showNotification(message, type = 'info') {
// Create notification element
const notification = document.createElement('div');
notification.className = `notification notification-${type}`;
notification.style.cssText = `
position: fixed;
top: 80px;
right: 20px;
background: ${type === 'success' ? '#10b981' : '#3b82f6'};
color: white;
padding: 1rem 1.5rem;
border-radius: 0.5rem;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
z-index: 10000;
animation: slideIn 0.3s ease-out;
max-width: 400px;
`;
notification.textContent = message;
// Add to document
document.body.appendChild(notification);
// Remove after 5 seconds
setTimeout(() => {
notification.style.animation = 'slideOut 0.3s ease-out';
setTimeout(() => {
document.body.removeChild(notification);
}, 300);
}, 5000);
}
// Add notification animations
const style = document.createElement('style');
style.textContent = `
@keyframes slideIn {
from {
transform: translateX(400px);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes slideOut {
from {
transform: translateX(0);
opacity: 1;
}
to {
transform: translateX(400px);
opacity: 0;
}
}
`;
document.head.appendChild(style);
// ==================== //
// Intersection Observer for Animations
// ==================== //
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('fade-in');
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Observe elements for animation
document.querySelectorAll('.highlight-card, .schedule-day, .topic-card, .instructor-card, .pricing-card').forEach(el => {
observer.observe(el);
});
// ==================== //
// Dynamic Year Update
// ==================== //
const currentYear = new Date().getFullYear();
document.querySelectorAll('.footer-bottom p').forEach(el => {
el.textContent = el.textContent.replace('2026', currentYear);
});
// ==================== //
// Scroll to Top Functionality
// ==================== //
let scrollToTopBtn = document.createElement('button');
scrollToTopBtn.innerHTML = '↑';
scrollToTopBtn.setAttribute('id', 'scrollToTop');
scrollToTopBtn.style.cssText = `
position: fixed;
bottom: 30px;
right: 30px;
width: 50px;
height: 50px;
border-radius: 50%;
background: linear-gradient(135deg, #2563eb, #8b5cf6);
color: white;
border: none;
font-size: 1.5rem;
cursor: pointer;
display: none;
align-items: center;
justify-content: center;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
z-index: 999;
`;
document.body.appendChild(scrollToTopBtn);
window.addEventListener('scroll', () => {
if (window.scrollY > 500) {
scrollToTopBtn.style.display = 'flex';
} else {
scrollToTopBtn.style.display = 'none';
}
});
scrollToTopBtn.addEventListener('click', () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
scrollToTopBtn.addEventListener('mouseenter', () => {
scrollToTopBtn.style.transform = 'scale(1.1)';
});
scrollToTopBtn.addEventListener('mouseleave', () => {
scrollToTopBtn.style.transform = 'scale(1)';
});
// ==================== //
// Console Welcome Message
// ==================== //
console.log('%c🏔️ ALPINE Workshop 2026', 'font-size: 16px; font-weight: bold; color: #2563eb;');
console.log('%cAnalysis of Pathogens & Inference of Epidemics', 'font-size: 14px; color: #6b7280;');
console.log('%cReady to code? Registration opening soon!', 'font-size: 12px; color: #10b981;');