-
Notifications
You must be signed in to change notification settings - Fork 23
/
FAQ's
154 lines (125 loc) · 4.01 KB
/
FAQ's
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
this contain three files index.html, style.css and main.js
I have seperated files with stars scroll and you will get to know
//********************************************************************************index.html***************************************************************************
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FAQs</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="faqs-container">
<h2>Frequently Asked Questions</h2>
<div class="questions-container">
<div class="content-container">
<div class="faq-header">
<h3>What is HackerBoi website?</h3>
<span class="open active">+</span>
<span class="close">-</span>
</div>
<div class="content">
<p>
It's an open-source project.
By participating here,you are participating in HECKTOBERFEST 2022
</p>
</div>
</div>
<div class="content-container">
<div class="faq-header">
<h3>How do I see HackerBoi availability?</h3>
<span class="open active">+</span>
<span class="close">-</span>
</div>
<div class="content">
<p>
----
</p>
</div>
</div>
<div class="content-container">
<div class="faq-header">
<h3>Why is HackerBoi so popular?</h3>
<span class="open active">+</span>
<span class="close">-</span>
</div>
<div class="content">
<p>
HackerBoi is built by developers for developers, and we're proud to be home to the worlds's largest open source community.
</p>
</div>
</div>
</div>
</div>
<script src="main.js"></script>
</body>
</html>
*************************************************************************** style.css***********************************************************************************
.faqs-container {
font-family: "Roboto", sans-serif;
max-width: 700px;
margin: 0 auto;
}
.faqs-container .questions-container {
box-shadow: 0 4px 8px -3px rgba(0, 0, 0, 0.3);
}
.faqs-container h2 {
padding: 4px 32px;
font-size: 28px;
}
.faqs-container .faq-header {
display: flex;
background: #03071e;
color: #f1faee;
align-items: center;
position: relative;
cursor: pointer;
}
.faqs-container .faq-header .open,
.faqs-container .faq-header .close {
position: absolute;
right: 0;
padding: 0 32px;
font-size: 22px;
font-weight: bold;
transform: translateY(-8px);
opacity: 0;
transition: all 500ms;
}
.faqs-container .faq-header .open.active,
.faqs-container .faq-header .close.active {
opacity: 1;
transform: translateY(0);
}
.faqs-container .faq-header h3 {
font-size: 20px;
padding: 0 32px;
}
.faqs-container .content {
padding: 0 32px;
background: #fdfffc;
line-height: 2;
max-height: 0;
overflow: hidden;
transition: all 500ms;
}
.faqs-container .content.active {
max-height: 600px;
}
**********************************************************************main.js*********************************************************************************
const faqHeaders = document.querySelectorAll(".faqs-container .faq-header");
faqHeaders.forEach((header, i) => {
header.addEventListener("click", () => {
header.nextElementSibling.classList.toggle("active");
const open = header.querySelector(".open");
const close = header.querySelector(".close");
if (header.nextElementSibling.classList.contains("active")) {
open.classList.remove("active");
close.classList.add("active");
} else {
open.classList.add("active");
close.classList.remove("active");
}
});
});