-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex.css
More file actions
88 lines (80 loc) · 2.5 KB
/
Copy pathex.css
File metadata and controls
88 lines (80 loc) · 2.5 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// ===============================
// Overlay Menu Controls
// ===============================
function menuOpen() {
// Show overlay menu
document.getElementById('menu_area').style.display = 'block';
document.getElementById('menu_overlay').style.display = 'block';
}
function menuClose() {
// Hide overlay menu
document.getElementById('menu_area').style.display = 'none';
document.getElementById('menu_overlay').style.display = 'none';
}
// ===============================
// Smooth Scroll for In-Page Links
// ===============================
// If your HTML uses [data-scroll-to] or anchor links with #IDs:
document.querySelectorAll('a[href^="#"]').forEach(link => {
link.addEventListener('click', function(e) {
const targetID = this.getAttribute('href').slice(1);
// If there's no target or it's just "#", skip
if (!targetID) return;
e.preventDefault();
const targetEl = document.getElementById(targetID);
if (targetEl) {
window.scrollTo({
top: targetEl.offsetTop - 50, // offset if needed
behavior: 'smooth'
});
}
// Also close the menu if link was inside overlay
menuClose();
});
});
// ===============================
// Modal Controls
// ===============================
const openModalButtons = document.querySelectorAll('.openModal');
const modal = document.getElementById('modal');
const closeModalBtn = document.getElementById('closeModal');
if (openModalButtons && modal) {
openModalButtons.forEach(btn => {
btn.addEventListener('click', () => {
modal.classList.remove('hidden');
});
});
}
if (closeModalBtn && modal) {
closeModalBtn.addEventListener('click', () => {
modal.classList.add('hidden');
});
}
// ===============================
// Scroll To Top Button
// ===============================
const scrollBtn = document.getElementById('scrollToTop');
window.addEventListener('scroll', () => {
if (window.scrollY > 400) {
scrollBtn.classList.remove('hidden');
} else {
scrollBtn.classList.add('hidden');
}
});
if (scrollBtn) {
scrollBtn.addEventListener('click', () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
}
// ===============================
// Page Load Animations
// (Optional if you're using "fade-in" with CSS keyframes)
// ===============================
document.addEventListener('DOMContentLoaded', () => {
// If you want immediate fade in from ex.css animation,
// you can rely on the .fade-in class alone.
// Or do additional JS-driven animations here.
});