cwadayi commited on
Commit
95c3513
·
verified ·
1 Parent(s): ffbae86

Create script.js

Browse files
Files changed (1) hide show
  1. script.js +17 -0
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
+ });