-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (25 loc) · 899 Bytes
/
Copy pathscript.js
File metadata and controls
30 lines (25 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
document.addEventListener('DOMContentLoaded', () => {
// Easter egg sound effect
const headerImg = document.querySelector('.header-img');
const clickSound = new Audio('./assets/toby-fox-bark.mp3');
headerImg.addEventListener('click', () => {
clickSound.currentTime = 0.1;
clickSound.play();
setTimeout(() => {
clickSound.pause();
clickSound.currentTime = 0;
}, 800);
});
const observerOptions = {
threshold: 0.3
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-in');
}
});
}, observerOptions);
const elements = document.querySelectorAll('.project-card, .skill-card, .text');
elements.forEach(el => observer.observe(el));
});