-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
72 lines (62 loc) · 2.45 KB
/
Copy pathscript.js
File metadata and controls
72 lines (62 loc) · 2.45 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* ═══════════════════════════════════════════
leitoraincomum.com.br — script.js
Fernanda Souza | @leitoraincomum
═══════════════════════════════════════════ */
/* ── CUSTOM CURSOR ── */
const cursor = document.getElementById('cursor');
const ring = document.getElementById('cursorRing');
let mx = 0, my = 0, rx = 0, ry = 0;
document.addEventListener('mousemove', e => {
mx = e.clientX;
my = e.clientY;
cursor.style.left = mx + 'px';
cursor.style.top = my + 'px';
});
(function animateRing() {
rx += (mx - rx) * 0.12;
ry += (my - ry) * 0.12;
ring.style.left = rx + 'px';
ring.style.top = ry + 'px';
requestAnimationFrame(animateRing);
})();
document.querySelectorAll('a, button, .pill, .tech-tag').forEach(el => {
el.addEventListener('mouseenter', () => {
cursor.style.transform = 'translate(-50%,-50%) scale(2.5)';
ring.style.opacity = '0';
});
el.addEventListener('mouseleave', () => {
cursor.style.transform = 'translate(-50%,-50%) scale(1)';
ring.style.opacity = '0.5';
});
});
/* ── NAV SCROLL ── */
window.addEventListener('scroll', () => {
document.getElementById('mainNav').classList.toggle('scrolled', scrollY > 60);
});
/* ── HAMBURGER MENU ── */
function toggleMenu() {
const btn = document.getElementById('hamburger');
const overlay = document.getElementById('navOverlay');
const isOpen = btn.classList.toggle('open');
overlay.classList.toggle('open', isOpen);
document.body.style.overflow = isOpen ? 'hidden' : '';
}
function closeMenu() {
document.getElementById('hamburger').classList.remove('open');
document.getElementById('navOverlay').classList.remove('open');
document.body.style.overflow = '';
}
/* ── EVENTO TABS ── */
function showTab(year, btn) {
document.querySelectorAll('.tab-content').forEach(t => t.classList.remove('active'));
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
document.getElementById('tab-' + year).classList.add('active');
btn.classList.add('active');
}
/* ── SCROLL REVEAL ── */
const observer = new IntersectionObserver(entries => {
entries.forEach(e => {
if (e.isIntersecting) e.target.classList.add('visible');
});
}, { threshold: 0.08 });
document.querySelectorAll('.reveal').forEach(el => observer.observe(el));