-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
55 lines (49 loc) · 1.67 KB
/
Copy pathscript.js
File metadata and controls
55 lines (49 loc) · 1.67 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
49
50
51
52
53
54
55
// Custom Cursor Logic
const customCursor = document.querySelector('.custom-cursor');
if (customCursor) {
window.addEventListener('mousemove', (e) => {
customCursor.style.left = `${e.clientX}px`;
customCursor.style.top = `${e.clientY}px`;
});
// Hover effect on links
document.querySelectorAll('a, .nav-link').forEach(el => {
el.addEventListener('mouseenter', () => {
customCursor.style.width = '40px';
customCursor.style.height = '40px';
customCursor.style.backgroundColor = '#FFFFFF';
});
el.addEventListener('mouseleave', () => {
customCursor.style.width = '12px';
customCursor.style.height = '12px';
customCursor.style.backgroundColor = 'var(--accent)';
});
});
}
// Navbar scroll effect
const navbar = document.querySelector('.editorial-nav');
window.addEventListener('scroll', () => {
let scrollTop = window.scrollY || document.documentElement.scrollTop;
if (scrollTop > 50) {
navbar.classList.add('scrolled');
} else {
navbar.classList.remove('scrolled');
}
});
// Intersection Observer for scroll animations
const observerOptions = {
threshold: 0.1,
rootMargin: "0px 0px -50px 0px"
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('active');
observer.unobserve(entry.target); // Only animate once
}
});
}, observerOptions);
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.reveal').forEach(el => {
observer.observe(el);
});
});