Spaces:
Running
Running
Create script.js
Browse files
script.js
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Smooth scrolling for nav links
|
2 |
+
document.querySelectorAll('a.nav-link').forEach(anchor => {
|
3 |
+
anchor.addEventListener('click', function(e) {
|
4 |
+
e.preventDefault();
|
5 |
+
const targetId = this.getAttribute('href').substring(1);
|
6 |
+
document.getElementById(targetId).scrollIntoView({ behavior: 'smooth' });
|
7 |
+
});
|
8 |
+
});
|
9 |
+
|
10 |
+
// Add animation on scroll
|
11 |
+
const observer = new IntersectionObserver((entries) => {
|
12 |
+
entries.forEach(entry => {
|
13 |
+
if (entry.isIntersecting) {
|
14 |
+
entry.target.classList.add('animate__animated', 'animate__fadeInUp');
|
15 |
+
}
|
16 |
+
});
|
17 |
+
});
|
18 |
+
|
19 |
+
document.querySelectorAll('.card, h2, .lead').forEach(el => {
|
20 |
+
observer.observe(el);
|
21 |
+
});
|