-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
40 lines (34 loc) · 1.03 KB
/
script.js
File metadata and controls
40 lines (34 loc) · 1.03 KB
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
31
32
33
34
35
36
37
38
39
40
// Scroll Reveal Animation
const observerOptions = {
threshold: 0.1
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('active');
}
});
}, observerOptions);
document.querySelectorAll('.reveal').forEach(el => {
observer.observe(el);
});
// Cursor Blob Animation
const blob = document.querySelector('.cursor-blob');
document.addEventListener('mousemove', (e) => {
const { clientX, clientY } = e;
blob.animate({
left: `${clientX - 300}px`,
top: `${clientY - 300}px`
}, { duration: 3000, fill: "forwards" });
});
// Navbar background change on scroll
window.addEventListener('scroll', () => {
const nav = document.getElementById('navbar');
if (window.scrollY > 50) {
nav.style.padding = '1rem 0';
nav.style.background = 'rgba(5, 5, 5, 0.8)';
} else {
nav.style.padding = '1.5rem 0';
nav.style.background = 'rgba(5, 5, 5, 0.5)';
}
});