-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
73 lines (63 loc) · 2.54 KB
/
Copy pathscript.js
File metadata and controls
73 lines (63 loc) · 2.54 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
document.addEventListener('DOMContentLoaded', () => {
// Reveal Animation on Scroll
const observerOptions = {
threshold: 0.15,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('active');
}
});
}, observerOptions);
const revealElements = document.querySelectorAll('.reveal');
revealElements.forEach(el => observer.observe(el));
// Staggered Reveal for Cards
const offeringGrids = document.querySelectorAll('.offering-grid, .bento-grid');
offeringGrids.forEach(grid => {
const cards = grid.querySelectorAll('.reveal');
cards.forEach((card, index) => {
card.style.transitionDelay = `${index * 0.1}s`;
});
});
// Sticky Header Effect
const header = document.querySelector('header');
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
header.style.padding = '0.8rem 0';
header.style.background = 'rgba(11, 15, 25, 0.95)';
header.style.boxShadow = '0 10px 30px rgba(0,0,0,0.5)';
} else {
header.style.padding = '1.5rem 0';
header.style.background = 'rgba(11, 15, 25, 0.8)';
header.style.boxShadow = 'none';
}
});
// Theme Toggle Functionality
const themeToggle = document.getElementById('theme-toggle');
const themeIcon = themeToggle.querySelector('.icon');
const body = document.body;
// Check for saved theme
const savedTheme = localStorage.getItem('theme') || 'dark';
body.setAttribute('data-theme', savedTheme);
updateThemeIcon(savedTheme);
themeToggle.addEventListener('click', () => {
const currentTheme = body.getAttribute('data-theme');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
body.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
updateThemeIcon(newTheme);
});
function updateThemeIcon(theme) {
themeIcon.textContent = theme === 'dark' ? '🌙' : '☀️';
}
// Logo Parallax/Float effect
const logo = document.querySelector('.logo img');
document.addEventListener('mousemove', (e) => {
const amount = 5;
const x = (e.clientX / window.innerWidth - 0.5) * amount;
const y = (e.clientY / window.innerHeight - 0.5) * amount;
logo.style.transform = `translate(${x}px, ${y}px)`;
});
});