-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
42 lines (37 loc) · 1.43 KB
/
Copy pathscript.js
File metadata and controls
42 lines (37 loc) · 1.43 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
// Year stamp in footer
document.getElementById('year').textContent = new Date().getFullYear();
// Mobile nav toggle
const nav = document.querySelector('.nav');
const toggle = document.querySelector('.nav-toggle');
toggle?.addEventListener('click', () => {
const open = nav.classList.toggle('open');
toggle.setAttribute('aria-expanded', open);
});
// Close mobile nav on link click
document.querySelectorAll('.nav-links a').forEach(link => {
link.addEventListener('click', () => nav.classList.remove('open'));
});
// Render stars precisely based on data-rating
document.querySelectorAll('.stars').forEach(el => {
const r = parseFloat(el.dataset.rating || '0');
const full = Math.floor(r);
const half = r - full >= 0.5;
const empty = 5 - full - (half ? 1 : 0);
el.textContent = '★'.repeat(full) + (half ? '⯨' : '') + '☆'.repeat(empty);
});
// Subtle scroll reveal
const io = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
io.unobserve(entry.target);
}
});
}, { threshold: 0.08, rootMargin: '0px 0px -40px 0px' });
document.querySelectorAll('.app-card, .project-card, .skill-block, .role, .stat, .edu-card').forEach(el => {
el.style.opacity = '0';
el.style.transform = 'translateY(16px)';
el.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
io.observe(el);
});