Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAQ enhancement #311

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"liveServer.settings.port": 5502
"liveServer.settings.port": 5503
}
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -349,31 +349,31 @@ <h1 class="faq-title">Frequently Asked Questions</h1>

<div class="faq">
<input type="checkbox" id="faq1">
<label for="faq1" class="faq-question">1. Does your website consist of all types of gaming tools?</label>
<label for="faq1" class="faq-question">1. Does your website consist of all types of gaming tools? <span class="arrow"></span></label>
<div class="faq-answer">
We have tried our best to make all the tools available for enthusiastic gamers.
</div>
</div>

<div class="faq">
<input type="checkbox" id="faq2">
<label for="faq2" class="faq-question">2. If I'm having some purchased-product related issues, can the product be replaced as per my need?</label>
<label for="faq2" class="faq-question">2. If I'm having some purchased-product related issues, can the product be replaced as per my need? <span class="arrow"></span></label>
<div class="faq-answer">
By considering our terms and conditions, further actions will be taken.
</div>
</div>

<div class="faq">
<input type="checkbox" id="faq3">
<label for="faq3" class="faq-question">3. Can I buy multiple products at once?</label>
<label for="faq3" class="faq-question">3. Can I buy multiple products at once? <span class="arrow"></span></label>
<div class="faq-answer">
Yes, you are welcomed to buy multiple products at one time.
</div>
</div>

<div class="faq">
<input type="checkbox" id="faq4">
<label for="faq4" class="faq-question">4. Do you have any free courier services or is it paid?</label>
<label for="faq4" class="faq-question">4. Do you have any free courier services or is it paid? <span class="arrow"></span></label>
<div class="faq-answer">
Currently that option is unavailable. Sorry for the inconvenience.
</div>
Expand Down
12 changes: 12 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,15 @@ async function SendEmail(e) {
alert("An error occurred while sending the email.");
}
}

// faq
document.querySelectorAll('.faq input[type="checkbox"]').forEach((checkbox) => {
checkbox.addEventListener('change', function () {
const answer = this.nextElementSibling.nextElementSibling; // FAQ answer div
if (this.checked) {
answer.style.maxHeight = answer.scrollHeight + 'px';
} else {
answer.style.maxHeight = '0px';
}
});
});
22 changes: 19 additions & 3 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,10 @@ button:hover img {
border: none;
border-radius: 5px;
cursor: pointer;
display: block;
/* display: block; */
display: flex;
justify-content: space-between;
align-items: center;
transition: background-color 0.3s ease;
}

Expand All @@ -1172,14 +1175,27 @@ button:hover img {
background-color: #ffe0b5;
color: #333;
border-left: 4px solid #ff8552;
transition: max-height 0.4s ease;
transition: all 0.6s ease;
}

.faq input[type="checkbox"]:checked ~ .faq-answer {
max-height: 150px;
padding: 15px;
}

.arrow {
margin-top: -3px;
display: inline-block;
width: 12px;
height: 12px;
border-right: 2px solid #fff;
border-bottom: 2px solid #fff;
transform: rotate(45deg);
transition: transform 0.3s ease;
}
/* Rotate arrow on FAQ open */
.faq input[type="checkbox"]:checked + label .arrow {
transform: rotate(225deg);
}

/* Body styles for consistency */
#review-body {
Expand Down