1
2
3
4
5
6
7
8
9
10
11
12
| const observer = new IntersectionObserver((entries) => {
| entries.forEach(entry => {
| if (entry.isIntersecting) {
| loadVideo(entry.target);
| observer.unobserve(entry.target);
| }
| });
| });
|
| document.querySelectorAll('.video-container .placeholder').forEach(el => {
| observer.observe(el);
| });
|
|