Skip to content

Commit f74a523

Browse files
committed
Made the footer responsive and FAQ changes
1 parent fcfb79d commit f74a523

File tree

4 files changed

+83
-51
lines changed

4 files changed

+83
-51
lines changed

assets/css_files/faq.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ body {
4949

5050
.faqs_container {
5151
height: 100%;
52-
width: 100%;
52+
width: 80%;
53+
padding-left: 20%;
5354
display: grid;
5455
grid-template-columns: 1fr;
5556
gap: 2rem;

assets/html_files/faq.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
<div class="faqHeading">Frequently Asked Questions</div>
9494
<div class="faqs">
9595
<div class="faqs_container"></div>
96-
<div class="faqs_container"></div>
9796
</div>
9897
</main>
9998

assets/js_files/faq.js

Lines changed: 37 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -48,61 +48,49 @@ const faq = [
4848
},
4949
];
5050

51-
/**
52-
*
53-
* @param {MouseEvent} e
54-
*/
51+
// Create the accordion
52+
const faqContainer = document.querySelector(".faqs_container");
5553

56-
// The Function to toggle the FAQ Content
57-
function toggleContent(e) {
58-
const content = e.currentTarget.faqContent;
59-
content.show = !content.show;
54+
faq.forEach((item) => {
55+
// Create the FAQ item
56+
const faqItem = document.createElement("div");
57+
faqItem.classList.add("faq");
6058

61-
content.style.height = content.show
62-
? content.scrollHeight + 20 + `px`
63-
: `0px`;
64-
content.style.padding = content.show ? `10px 0` : `0`;
65-
66-
const plus = e.currentTarget.plus;
67-
plus.style.transform = content.show ? `rotate(45deg)` : `none`;
68-
}
69-
70-
// The Template Function for the FAQ
71-
faq.forEach(function (item, index) {
72-
const faqItem = document.createElement(`div`);
73-
faqItem.classList.add(`faq`);
59+
// Create the title and toggle button
7460
faqItem.innerHTML = `
75-
<div class="faq_title">
76-
<span>${item.question}</span>
77-
<div class="plusBtn">
78-
<svg
79-
class="plus"
80-
xmlns="http://www.w3.org/2000/svg"
81-
width="16"
82-
height="16"
83-
fill="#ff1b82"
84-
viewBox="0 0 16 16"
85-
stroke-width="2"
86-
stroke="#ff1b82"
87-
>
88-
<path
89-
fill-rule="evenodd"
90-
d="M8 0a.75.75 0 01.75.75v6.5h6.5a.75.75 0 010 1.5h-6.5v6.5a.75.75 0 01-1.5 0v-6.5H.75a.75.75 0 010-1.5h6.5V.75A.75.75 0 018 0z"
91-
/>
92-
</svg>
93-
<div>
61+
<div class="faq_title">
62+
<span>${item.question}</span>
63+
<div class="plusBtn">
64+
<svg class="plus" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#ff1b82" viewBox="0 0 16 16" stroke-width="2" stroke="#ff1b82">
65+
<path fill-rule="evenodd" d="M8 0a.75.75 0 01.75.75v6.5h6.5a.75.75 0 010 1.5h-6.5v6.5a.75.75 0 01-1.5 0v-6.5H.75a.75.75 0 010-1.5h6.5V.75A.75.75 0 018 0z"/>
66+
</svg>
9467
</div>
95-
`;
96-
97-
faqItem.plus = faqItem.querySelector(`.plus`);
68+
</div>
69+
`;
9870

99-
const faqContent = document.createElement(`div`);
100-
faqContent.classList.add(`faq_content`);
71+
// Create the content section
72+
const faqContent = document.createElement("div");
73+
faqContent.classList.add("faq_content");
10174
faqContent.innerHTML = item.answer;
75+
faqContent.style.height = "0px"; // Start collapsed
10276
faqItem.appendChild(faqContent);
10377

104-
faqItem.faqContent = faqContent;
78+
// Append to the container
79+
faqContainer.appendChild(faqItem);
10580

106-
faqItem.addEventListener(`click`, toggleContent);
107-
document.querySelectorAll(`.faqs_container`)[index % 2].appendChild(faqItem);
108-
});
81+
// Toggle content
82+
faqItem.querySelector(".faq_title").addEventListener("click", () => {
83+
const allFaqs = document.querySelectorAll(".faq_content");
84+
allFaqs.forEach((content) => {
85+
if (content !== faqContent) {
86+
content.style.height = "0px"; // Collapse others
87+
content.parentNode.querySelector(".plus").style.transform = "none"; // Reset plus icon
88+
}
89+
});
90+
91+
// Toggle current FAQ
92+
const isOpen = faqContent.style.height !== "0px";
93+
faqContent.style.height = isOpen ? "0px" : `${faqContent.scrollHeight}px`;
94+
faqItem.querySelector(".plus").style.transform = isOpen ? "none" : "rotate(45deg)";
95+
});
96+
});

style.css

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,50 @@ footer {
12851285
}
12861286
}
12871287

1288+
@media (max-width: 500px) {
1289+
.company-info {
1290+
flex: 1 1 100%; /* Make company info take full width */
1291+
text-align: center;
1292+
margin-bottom: 20px;
1293+
}
1294+
1295+
/* Split the quick-links into two columns */
1296+
.footer-ul {
1297+
display: grid;
1298+
grid-template-columns: 1fr 1fr;
1299+
gap: 10px;
1300+
}
1301+
1302+
.send-message {
1303+
flex: 1 1 100%;
1304+
text-align: center;
1305+
}
1306+
1307+
.group1 {
1308+
flex-direction: column;
1309+
}
1310+
1311+
.group1 input {
1312+
margin-bottom: 5px;
1313+
}
1314+
1315+
.send-message input,
1316+
.send-message textarea {
1317+
width: 100%;
1318+
resize: vertical;
1319+
}
1320+
1321+
.social {
1322+
flex-wrap: wrap;
1323+
justify-content: center;
1324+
gap: 8px;
1325+
}
1326+
1327+
.social a {
1328+
font-size: 2.5rem;
1329+
}
1330+
}
1331+
12881332
@media (max-width: 400px) {
12891333
.paragraph {
12901334
width: 100%;

0 commit comments

Comments
 (0)