Skip to content

Commit eca1435

Browse files
authored
Refactor and clean up script.js
1 parent 0ce0a04 commit eca1435

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

script.js

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -33,46 +33,6 @@ toggleButtons.forEach(button => {
3333
});
3434
});
3535

36-
const cards = document.querySelectorAll('.card video');
37-
cards.forEach(video => {
38-
video.addEventListener('mouseenter', () => video.play());
39-
video.addEventListener('mouseleave', () => video.pause());
40-
});
41-
const animated = document.querySelectorAll(
42-
'[data-animate], [data-pop], .card, .feature__media video, .card video'
43-
);
44-
45-
const observer = new IntersectionObserver(
46-
entries => {
47-
entries.forEach(entry => {
48-
if (entry.isIntersecting) {
49-
entry.target.classList.add('is-visible');
50-
if (entry.target.tagName === 'VIDEO') {
51-
entry.target.play().catch(() => {});
52-
}
53-
}
54-
});
55-
},
56-
{ threshold: 0.35 }
57-
);
58-
59-
animated.forEach(el => observer.observe(el));
60-
61-
const toggleButtons = document.querySelectorAll('.play-toggle');
62-
63-
toggleButtons.forEach(button => {
64-
const video = button.previousElementSibling;
65-
button.addEventListener('click', () => {
66-
if (video.paused) {
67-
video.play();
68-
button.querySelector('span').textContent = 'pause';
69-
} else {
70-
video.pause();
71-
button.querySelector('span').textContent = 'play';
72-
}
73-
});
74-
});
75-
7636
const cards = document.querySelectorAll('.card video');
7737
cards.forEach(video => {
7838
video.addEventListener('mouseenter', () => video.play());

0 commit comments

Comments
 (0)