forked from derrickjohnpiper/AI_BLOG_TEAM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
57 lines (50 loc) · 1.96 KB
/
Copy pathscript.js
File metadata and controls
57 lines (50 loc) · 1.96 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
document.addEventListener('DOMContentLoaded', () => {
// Smooth scrolling for navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
window.scrollTo({
top: targetElement.offsetTop - 80, // Offset for navbar
behavior: 'smooth'
});
}
});
});
// Reveal elements on scroll
const observerOptions = {
root: null,
rootMargin: '0px',
threshold: 0.1
};
const observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Apply starting styles and observe
const stepCards = document.querySelectorAll('.step-card');
stepCards.forEach((card, index) => {
card.style.opacity = '0';
card.style.transform = 'translateY(20px)';
card.style.transition = `all 0.6s ease ${index * 0.1}s`;
observer.observe(card);
});
// Parallax effect for blobs
window.addEventListener('mousemove', (e) => {
const mouseX = e.clientX / window.innerWidth - 0.5;
const mouseY = e.clientY / window.innerHeight - 0.5;
const blobs = document.querySelectorAll('.glow-blob');
blobs.forEach((blob, index) => {
const factor = index === 0 ? 30 : -40;
blob.style.transform = `translate(${mouseX * factor}px, ${mouseY * factor}px)`;
});
});
});