forked from mansiruhil13/Bobble-AI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
48 lines (38 loc) · 1.85 KB
/
script.js
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
// Newsletter form submission handler
document.getElementById('newsletter-form').addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the form from submitting normally
const emailInput = document.getElementById('email');
const confirmationMessage = document.getElementById('confirmation-message');
// Optionally send the email to your backend
const email = emailInput.value;
// Simulate a successful submission (you could replace this with an actual API call)
console.log(`Email submitted: ${email}`); // For debugging
// Display the confirmation message
confirmationMessage.textContent = 'Thank you for subscribing! Please check your email for further instructions.';
confirmationMessage.classList.remove('hidden');
// Clear the form
emailInput.value = '';
});
// Accordion functionality
const accordions = document.querySelectorAll(".accordion");
accordions.forEach((accordion, index) => {
const header = accordion.querySelector(".accordion__header");
const content = accordion.querySelector(".accordion__content");
const icon = accordion.querySelector(".accordion__icon i");
header.addEventListener("click", () => {
const isOpen = content.style.height === `${content.scrollHeight}px`;
accordions.forEach((a, i) => {
const c = a.querySelector(".accordion__content");
const ic = a.querySelector(".accordion__icon i");
if (i === index) {
c.style.height = isOpen ? "0px" : `${c.scrollHeight}px`;
ic.classList.toggle("ri-add-line", isOpen);
ic.classList.toggle("ri-subtract-fill", !isOpen);
} else {
c.style.height = "0px";
ic.classList.add("ri-add-line");
ic.classList.remove("ri-subtract-fill");
}
});
});
});