-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
63 lines (61 loc) · 2.65 KB
/
script.js
File metadata and controls
63 lines (61 loc) · 2.65 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
(function(){
emailjs.init("JvC6HMd-zwoNlFQF2"); //Public key
})();
document.addEventListener('DOMContentLoaded', function() {
const showBookingFormBtn = document.getElementById("show-booking-form");
const bookingFormContainer = document.getElementById("booking-form-container");
const bookingIntroText = document.querySelector(".booking-intro p");
if (showBookingFormBtn && bookingFormContainer && bookingIntroText) {
showBookingFormBtn.addEventListener("click", function() {
bookingFormContainer.style.display = "block";
this.style.display = "none";
bookingIntroText.style.display = "none";
// Smooth scroll to the form
bookingFormContainer.scrollIntoView({ behavior: 'smooth' });
});
}
// FAQ functionality
const faqItems = document.querySelectorAll('.faq-item');
if (faqItems) {
faqItems.forEach(item => {
const question = item.querySelector('.faq-question');
question.addEventListener('click', () => {
// Close all open answers
faqItems.forEach(i => {
if (i !== item) i.classList.remove('active');
});
// Toggle this one
item.classList.toggle('active');
});
});
}
// Contact form submission
const contactForm = document.getElementById("contact-form");
if (contactForm) {
contactForm.addEventListener("submit", function(e) {
e.preventDefault();
emailjs.sendForm('service_8i4g6fs', 'template_2jx529o', this)
.then(function(response) {
alert("Message sent successfully! ✅");
contactForm.reset();
}, function(error) {
alert("Failed to send message ❌\n" + error.text);
});
});
}
// Booking form submission
const bookingForm = document.getElementById("booking-form");
if (bookingForm) {
bookingForm.addEventListener("submit", function(e) {
e.preventDefault();
emailjs.sendForm("service_8i4g6fs", "template_bqteb1j", this)
.then(() => {
alert("Booking request sent!");
bookingForm.reset();
})
.catch(error => {
alert("Failed to send booking. " + error);
});
});
}
});