forked from 07sumit1002/CabRental
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
74 lines (68 loc) · 2.11 KB
/
main.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
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
function validateForm() {
var name = document.forms["myForm"]["name"].value;
var email = document.forms["myForm"]["email"].value;
var tel = document.forms["myForm"]["tel"].value;
var location = document.forms["myForm"]["location"].value;
var time = document.forms["myForm"]["time"].value;
if (name == "") {
alert("Name must be filled out");
return false;
}
if (email == "") {
alert("Email must be filled out");
return false;
}
if (tel == "") {
alert("Contact must be filled out");
return false;
}
if (location == "") {
alert("Location must be filled out");
return false;
}
if (time == "") {
alert("Time must be filled out");
return false;
}
}
var swiper = new Swiper(".review-slider", {
loop: true,
grabCursor: true,
spaceBetween: 20,
centeredSlides: true,
autoplay: {
delay: 1800,
disableOnInteraction: false,
},
pagination: {
el: ".swiper-pagination",
},
});
AOS.init({
duration: 800,
delay: 400
});
//FAQ SECTION JS STARTING
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");
}
});
});
});
//FAQ SECTION JS ENDS HERE