-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
34 lines (28 loc) · 921 Bytes
/
script.js
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
// script.js
// Smooth scrolling for anchor links (if you have any)
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
// Optional: Add animations when elements come into the viewport
const sections = document.querySelectorAll('.project-section');
const options = {
root: null,
threshold: 0.1,
};
const revealSection = (entries, observer) => {
entries.forEach(entry => {
if (!entry.isIntersecting) return;
entry.target.classList.add('visible');
observer.unobserve(entry.target);
});
};
const observer = new IntersectionObserver(revealSection, options);
sections.forEach(section => {
observer.observe(section);
section.classList.add('hidden');
});