Repository navigation
Expand file tree
/
Copy pathmain.js
More file actions
101 lines (78 loc) · 3.24 KB
/
Copy pathmain.js
File metadata and controls
101 lines (78 loc) · 3.24 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
document.addEventListener('DOMContentLoaded', function() {
if (typeof AOS !== 'undefined') {
AOS.init({
duration: 800,
easing: 'ease',
once: true,
offset: 100,
});
}
const hamburger = document.querySelector('.hamburger-menu');
const nav = document.querySelector('nav');
if (hamburger && nav) {
hamburger.addEventListener('click', function() {
this.classList.toggle('menu-open');
nav.classList.toggle('active');
});
const navLinks = document.querySelectorAll('.nav-link, .join-btn');
navLinks.forEach(link => {
link.addEventListener('click', function() {
hamburger.classList.remove('menu-open');
nav.classList.remove('active');
});
});
}
const header = document.querySelector('header');
window.addEventListener('scroll', function() {
if (window.scrollY > 50) {
header.classList.add('navbar-scrolled');
} else {
header.classList.remove('navbar-scrolled');
}
});
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) {
const headerHeight = document.querySelector('header').offsetHeight;
const targetPosition = targetElement.offsetTop - headerHeight;
window.scrollTo({
top: targetPosition,
behavior: 'smooth'
});
}
});
});
const buttons = document.querySelectorAll('.cta-button, .join-btn');
buttons.forEach(button => {
button.addEventListener('click', function(e) {
const x = e.clientX - e.target.getBoundingClientRect().left;
const y = e.clientY - e.target.getBoundingClientRect().top;
const ripple = document.createElement('span');
ripple.classList.add('ripple');
ripple.style.position = 'absolute';
ripple.style.background = 'rgba(255, 255, 255, 0.3)';
ripple.style.borderRadius = '50%';
ripple.style.pointerEvents = 'none';
ripple.style.transform = 'translate(-50%, -50%)';
ripple.style.animation = 'ripple-animation 0.6s linear';
ripple.style.left = `${x}px`;
ripple.style.top = `${y}px`;
if (getComputedStyle(this).position === 'static') {
this.style.position = 'relative';
}
this.style.overflow = 'hidden';
this.appendChild(ripple);
setTimeout(() => {
ripple.remove();
}, 600);
});
});
});
document.addEventListener('DOMContentLoaded', () => {
const yearEl = document.getElementById('current-year');
if (yearEl) yearEl.textContent = new Date().getFullYear();
});