-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
38 lines (36 loc) · 1.23 KB
/
script.js
File metadata and controls
38 lines (36 loc) · 1.23 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
function openLightbox(img) {
const lightbox = document.getElementById("lightbox");
const lightboxImg = document.getElementById("lightbox-img");
lightbox.style.display = "flex";
lightboxImg.src = img.src;
}
function closeLightbox() {
document.getElementById("lightbox").style.display = "none";
}
// Smooth scroll for internal links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', e => {
e.preventDefault();
const target = document.querySelector(anchor.getAttribute('href'));
if (target) {
target.scrollIntoView({ behavior: 'smooth' });
}
});
});
// Contact form alert
document.getElementById("contact-form").addEventListener("submit", function (e) {
e.preventDefault();
alert("Thanks for reaching out! I'll get back to you soon.");
this.reset();
});
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const fills = entry.target.querySelectorAll('.fill');
fills.forEach(fill => {
fill.style.width = fill.getAttribute('style').split(':')[1];
});
}
});
}, { threshold: 0.5 });
document.querySelectorAll('.about-right').forEach(el => observer.observe(el));