Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
61 lines (55 loc) · 2.16 KB
/
Copy pathscript.js
File metadata and controls
61 lines (55 loc) · 2.16 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
// Mobile menu
function toggleMenu() {
const nav = document.getElementById('navLinks');
const btn = document.getElementById('hamburger');
nav.classList.toggle('active');
btn.classList.toggle('open');
}
document.querySelectorAll('.nav-links a').forEach(link => {
link.addEventListener('click', () => {
document.getElementById('navLinks').classList.remove('active');
document.getElementById('hamburger').classList.remove('open');
});
});
// Navbar shadow on scroll
window.addEventListener('scroll', () => {
document.getElementById('navbar').classList.toggle('scrolled', window.scrollY > 40);
});
// Smooth scroll
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', block: 'start' });
});
});
// Booking form handled by Tally embed
// Modals
function openModal(type) {
const m = document.getElementById(type + 'Modal');
if (m) { m.classList.add('active'); document.body.style.overflow = 'hidden'; }
}
function closeModal(event, type) {
const m = document.getElementById(type + 'Modal');
if (!m) return;
if (event && !event.target.classList.contains('modal-overlay') && !event.target.closest('.modal-close')) return;
m.classList.remove('active');
document.body.style.overflow = '';
}
document.addEventListener('keydown', e => {
if (e.key === 'Escape') {
['privacy','refund','terms'].forEach(t => {
const m = document.getElementById(t + 'Modal');
if (m && m.classList.contains('active')) { m.classList.remove('active'); document.body.style.overflow = ''; }
});
}
});
document.querySelectorAll('.footer-links a').forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const text = this.innerText.toLowerCase();
if (text.includes('privacy')) openModal('privacy');
else if (text.includes('refund')) openModal('refund');
else if (text.includes('terms')) openModal('terms');
});
});