-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
446 lines (395 loc) · 15 KB
/
Copy pathscript.js
File metadata and controls
446 lines (395 loc) · 15 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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
document.addEventListener('DOMContentLoaded', function() {
// Preloader
setTimeout(function() {
const preloader = document.querySelector('.preloader');
preloader.classList.add('fade-out');
}, 1000);
// Initialize AOS
if (typeof AOS !== 'undefined') {
AOS.init({
duration: 800,
easing: 'ease-in-out',
once: true,
mirror: false
});
}
// Initialize Particles.js
if (document.getElementById('particles-js') && typeof particlesJS !== 'undefined') {
particlesJS('particles-js', {
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
"value": "#ffffff"
},
"shape": {
"type": "circle",
"stroke": {
"width": 0,
"color": "#000000"
},
"polygon": {
"nb_sides": 5
}
},
"opacity": {
"value": 0.5,
"random": false,
"anim": {
"enable": false,
"speed": 1,
"opacity_min": 0.1,
"sync": false
}
},
"size": {
"value": 3,
"random": true,
"anim": {
"enable": false,
"speed": 40,
"size_min": 0.1,
"sync": false
}
},
"line_linked": {
"enable": true,
"distance": 150,
"color": "#ffffff",
"opacity": 0.4,
"width": 1
},
"move": {
"enable": true,
"speed": 6,
"direction": "none",
"random": false,
"straight": false,
"out_mode": "out",
"bounce": false,
"attract": {
"enable": false,
"rotateX": 600,
"rotateY": 1200
}
}
},
"interactivity": {
"detect_on": "canvas",
"events": {
"onhover": {
"enable": true,
"mode": "grab"
},
"onclick": {
"enable": true,
"mode": "push"
},
"resize": true
},
"modes": {
"grab": {
"distance": 140,
"line_linked": {
"opacity": 1
}
},
"bubble": {
"distance": 400,
"size": 40,
"duration": 2,
"opacity": 8,
"speed": 3
},
"repulse": {
"distance": 200,
"duration": 0.4
},
"push": {
"particles_nb": 4
},
"remove": {
"particles_nb": 2
}
}
},
"retina_detect": true
});
}
// Mobile Navigation Toggle
const hamburger = document.querySelector('.hamburger');
const navLinks = document.querySelector('.nav-links');
if (hamburger) {
hamburger.addEventListener('click', function() {
this.classList.toggle('active');
navLinks.classList.toggle('active');
});
}
// Close mobile menu when clicking on a nav link
const navItems = document.querySelectorAll('.nav-links a');
navItems.forEach(item => {
item.addEventListener('click', function() {
hamburger.classList.remove('active');
navLinks.classList.remove('active');
});
});
// Active navigation on scroll
const sections = document.querySelectorAll('section');
const navLinks2 = document.querySelectorAll('.nav-links a');
window.addEventListener('scroll', function() {
let current = '';
sections.forEach(section => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (pageYOffset >= (sectionTop - sectionHeight / 3)) {
current = section.getAttribute('id');
}
});
navLinks2.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href').substring(1) === current) {
link.classList.add('active');
}
});
});
// Countdown Timer
const countdownElement = document.getElementById('countdown');
if (countdownElement) {
// Set the conference date - May 30, 2025
const conferenceDate = new Date('May 30, 2025 09:00:00').getTime();
// Update the countdown every second
const countdownTimer = setInterval(function() {
// Get today's date and time
const now = new Date().getTime();
// Find the distance between now and the conference date
const distance = conferenceDate - now;
// Time calculations for days, hours, minutes and seconds
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Display the result
document.getElementById('days').innerHTML = days.toString().padStart(2, '0');
document.getElementById('hours').innerHTML = hours.toString().padStart(2, '0');
document.getElementById('minutes').innerHTML = minutes.toString().padStart(2, '0');
document.getElementById('seconds').innerHTML = seconds.toString().padStart(2, '0');
// If the countdown is finished, display a message
if (distance < 0) {
clearInterval(countdownTimer);
countdownElement.innerHTML = "<h3>The Conference Has Started!</h3>";
}
}, 1000);
}
// Committee Tabs
const tabButtons = document.querySelectorAll('.tab-btn');
const tabPanes = document.querySelectorAll('.tab-pane');
tabButtons.forEach(button => {
button.addEventListener('click', function() {
// Remove active class from all buttons and panes
tabButtons.forEach(btn => btn.classList.remove('active'));
tabPanes.forEach(pane => pane.classList.remove('active'));
// Add active class to clicked button
this.classList.add('active');
// Show the corresponding tab pane
const tabId = this.getAttribute('data-tab');
document.getElementById(tabId).classList.add('active');
});
});
// Form Submission
const registerForm = document.getElementById('register-form');
if (registerForm) {
registerForm.addEventListener('submit', function(e) {
e.preventDefault();
// Simple form validation
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const institution = document.getElementById('institution').value;
const category = document.getElementById('category').value;
const terms = document.getElementById('terms').checked;
if (!name || !email || !institution || !category || !terms) {
alert('Please fill in all required fields and accept the terms and conditions.');
return;
}
// Here you would typically send the form data to a server
// For this demo, we'll just show a success message
alert('Registration successful! Thank you for registering for IFSTEM 2025.');
registerForm.reset();
});
}
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
targetElement.scrollIntoView({
behavior: 'smooth'
});
}
});
});
// Sticky header on scroll
const header = document.querySelector('header');
window.addEventListener('scroll', function() {
if (window.scrollY > 100) {
header.classList.add('sticky');
} else {
header.classList.remove('sticky');
}
});
// Progress bar
window.onscroll = function() {
let winScroll = document.body.scrollTop || document.documentElement.scrollTop;
let height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
let scrolled = (winScroll / height) * 100;
document.getElementById("progressBar").style.width = scrolled + "%";
// Back to top button
const backToTop = document.getElementById('backToTop');
if (backToTop) {
if (winScroll > 300) {
backToTop.classList.add('active');
} else {
backToTop.classList.remove('active');
}
}
};
// Back to top button click
const backToTop = document.getElementById('backToTop');
if (backToTop) {
backToTop.addEventListener('click', function(e) {
e.preventDefault();
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
}
// Counter animation
const counters = document.querySelectorAll('.counter');
const speed = 200;
const animateCounter = () => {
counters.forEach(counter => {
const target = +counter.getAttribute('data-target');
const count = +counter.innerText;
const increment = target / speed;
if (count < target) {
counter.innerText = Math.ceil(count + increment);
setTimeout(animateCounter, 1);
} else {
counter.innerText = target;
}
});
};
// Start counter animation when in viewport
const counterSection = document.querySelector('.stats-container');
if (counterSection) {
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
animateCounter();
observer.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
observer.observe(counterSection);
}
// Gallery lightbox
const galleryItems = document.querySelectorAll('.gallery-item');
galleryItems.forEach(item => {
item.addEventListener('click', function() {
const imgSrc = this.querySelector('img').getAttribute('src');
const caption = this.querySelector('.gallery-caption').textContent;
const lightbox = document.createElement('div');
lightbox.className = 'lightbox';
lightbox.innerHTML = `
<div class="lightbox-content">
<span class="close">×</span>
<img src="${imgSrc}" alt="${caption}">
<div class="caption">${caption}</div>
</div>
`;
document.body.appendChild(lightbox);
document.body.style.overflow = 'hidden';
setTimeout(() => {
lightbox.style.opacity = '1';
}, 10);
const close = lightbox.querySelector('.close');
close.addEventListener('click', function() {
lightbox.style.opacity = '0';
setTimeout(() => {
document.body.removeChild(lightbox);
document.body.style.overflow = 'auto';
}, 300);
});
lightbox.addEventListener('click', function(e) {
if (e.target === lightbox) {
lightbox.style.opacity = '0';
setTimeout(() => {
document.body.removeChild(lightbox);
document.body.style.overflow = 'auto';
}, 300);
}
});
});
});
// Add lightbox styles
const style = document.createElement('style');
style.innerHTML = `
.lightbox {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.9);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
opacity: 0;
transition: opacity 0.3s;
}
.lightbox-content {
position: relative;
max-width: 80%;
max-height: 80%;
}
.lightbox img {
max-width: 100%;
max-height: 80vh;
border-radius: 5px;
}
.lightbox .close {
position: absolute;
top: -40px;
right: 0;
color: white;
font-size: 30px;
cursor: pointer;
}
.lightbox .caption {
color: white;
text-align: center;
margin-top: 20px;
font-size: 1.2rem;
}
`;
document.head.appendChild(style);
});
// Clone items to create the infinite effect
window.addEventListener('DOMContentLoaded', () => {
const track = document.getElementById('carouselTrack');
const items = track.querySelectorAll('.carousel-item');
// Clone each item and append to create the infinite effect
items.forEach(item => {
const clone = item.cloneNode(true);
track.appendChild(clone);
});
});