-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
55 lines (48 loc) · 1.6 KB
/
script.js
File metadata and controls
55 lines (48 loc) · 1.6 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
// --- Spotlight Effect ---
// Adds a glowing gradient that follows the mouse cursor on cards
const spotlights = document.querySelectorAll('.spotlight');
spotlights.forEach(card => {
card.addEventListener('mousemove', (e) => {
const rect = card.getBoundingClientRect();
const x = e.clientX - rect.left;
const y = e.clientY - rect.top;
card.style.setProperty('--x', `${x}px`);
card.style.setProperty('--y', `${y}px`);
});
});
// --- Smooth Scroll for Anchor Links ---
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'
});
}
});
});
// --- Navbar Blur Effect on Scroll ---
window.addEventListener('scroll', () => {
const navbar = document.querySelector('.navbar');
if (window.scrollY > 50) {
navbar.style.background = "rgba(3, 3, 3, 0.9)";
navbar.style.borderBottom = "1px solid #333";
} else {
navbar.style.background = "rgba(3, 3, 3, 0.7)";
navbar.style.borderBottom = "1px solid #222";
}
});
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if(entry.isIntersecting){
entry.target.classList.add("show");
}
});
});
document.querySelectorAll(".spotlight").forEach(el => observer.observe(el));
document.querySelectorAll(".exp-card img").forEach(img => {
img.addEventListener("click", () => {
window.open(img.src, "_blank");
});
});