-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
48 lines (43 loc) · 1.53 KB
/
Copy pathscript.js
File metadata and controls
48 lines (43 loc) · 1.53 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
41
42
43
44
45
46
47
48
document.addEventListener('DOMContentLoaded', () => {
// Scroll Reveal functionality
const observerOptions = {
threshold: 0.15
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('revealed');
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Initial reveal elements
const revealElements = document.querySelectorAll('.reveal-on-scroll, .matrix-card, .project-card');
revealElements.forEach((el, index) => {
// Add default hidden class
el.style.opacity = '0';
el.style.transform = 'translateY(30px)';
el.style.transition = `all 0.8s ease-out ${index * 0.1}s`;
observer.observe(el);
});
// Custom CSS for revealed state
const styleSheet = document.createElement("style");
styleSheet.innerText = `
.revealed {
opacity: 1 !important;
transform: translateY(0) !important;
}
`;
document.head.appendChild(styleSheet);
// Navbar transparency change on scroll
const navbar = document.querySelector('.glass-navbar');
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
navbar.style.boxShadow = '0 10px 30px rgba(0,0,0,0.3)';
navbar.style.height = '70px';
} else {
navbar.style.boxShadow = 'none';
navbar.style.height = '80px';
}
});
});