forked from Mroziu12/DVP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
29 lines (26 loc) · 967 Bytes
/
main.js
File metadata and controls
29 lines (26 loc) · 967 Bytes
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
// ===== SMOOTH SCROLL =====
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// ===== NAVIGATION ACTIVE STATE =====
const currentPage = window.location.pathname.split('/').pop() || 'index.html';
const navLinks = document.querySelectorAll('.nav-links a');
navLinks.forEach(link => {
const linkPage = link.getAttribute('href');
if (linkPage === currentPage) {
link.classList.add('active');
} else {
link.classList.remove('active');
}
});
console.log('Job Market Analytics - Main Page initialized');
});