-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
58 lines (50 loc) · 2.19 KB
/
script.js
File metadata and controls
58 lines (50 loc) · 2.19 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
// Smooth scrolling
document.querySelectorAll('a[href^="#"]').forEach(
anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute
('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Navbar scroll effect
window.addEventListener('scroll', () => {
const navbar = document.querySelector('.navbar');
window.scrollY > 50 ?
navbar.style.backgroundColor = 'rgba(10, 10, 10, 0.98)' :
navbar.style.backgroundColor = 'rgba(10, 10, 10, 0.95)';
});
document.addEventListener("DOMContentLoaded", function() {
const toggle = document.querySelector('.nav-toggle');
const links = document.querySelector('.nav-links');
const linkItems = document.querySelectorAll('.nav-links a');
toggle.addEventListener('click', () => {
links.classList.toggle('active');
});
linkItems.forEach(link => {
link.addEventListener('click', () => {
links.classList.remove('active');
});
});
});
document.addEventListener("DOMContentLoaded", function() {
const skillCards = document.querySelectorAll('.skill-card, .project-card');
const observer = new IntersectionObserver(entries => {
entries.forEach((entry, index) => {
if (entry.isIntersecting) {
// Card enters view
setTimeout(() => {
entry.target.classList.add('visible');
}, index * 100);
} else {
// Card leaves view
entry.target.classList.remove('visible');
}
});
}, {
threshold: 0.2 // visible when 20% of the card is on screen
});
skillCards.forEach(card => observer.observe(card));
});