Spaces:
Running
Running
Create script.js
Browse files
script.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 2 |
+
const sections = document.querySelectorAll('section');
|
| 3 |
+
|
| 4 |
+
const observer = new IntersectionObserver(entries => {
|
| 5 |
+
entries.forEach(entry => {
|
| 6 |
+
if (entry.isIntersecting) {
|
| 7 |
+
entry.target.classList.add('visible');
|
| 8 |
+
}
|
| 9 |
+
});
|
| 10 |
+
}, {
|
| 11 |
+
threshold: 0.1
|
| 12 |
+
});
|
| 13 |
+
|
| 14 |
+
sections.forEach(section => {
|
| 15 |
+
observer.observe(section);
|
| 16 |
+
});
|
| 17 |
+
});
|