ادمج الاسئلة مع هذا الكود
<style>
.faq-container {
max-width: 800px;
margin: 40px auto;
font-family: Arial, sans-serif;
direction: rtl; /* جعل اتجاه المحتوى من اليمين لليسار */
text-align: right; /* محاذاة النص لليمين */
}
.faq-title {
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
}
.faq-item {
margin-bottom: 15px;
border-radius: 12px;
background: rgba(255, 255, 255, 0.85);
box-shadow: 0 4px 8px rgba(0,0,0,0.05);
overflow: hidden;
}
.faq-question {
width: 100%;
background: #f0f0f0;
border: none;
outline: none;
padding: 15px;
font-size: 16px;
text-align: right; /* محاذاة السؤال لليمين */
cursor: pointer;
}
.faq-answer {
max-height: 0;
padding: 0 15px;
overflow: hidden;
background: #fff;
transition: max-height 0.4s ease, padding 0.3s ease;
}
.faq-answer.open {
padding: 15px;
max-height: 500px;
}
</style>
<div class="faq-container">
<div class="faq-title">الأسئلة الشائعة</div>
<!--:
<div class="faq-item">
<button class="faq-question"></button>
<div class="faq-answer"></div>
</div>
-->
</div>
<script>
document.querySelectorAll('.faq-question').forEach((btn, idx) => {
btn.addEventListener('click', function () {
const answer = this.nextElementSibling;
const isOpen = answer.classList.contains('open');
document.querySelectorAll('.faq-answer').forEach(a => a.classList.remove('open'));
document.querySelectorAll('.faq-question').forEach(q => q.classList.remove('active'));
if (!isOpen) {
answer.classList.add('open');
this.classList.add('active');
}
});
if (idx === 0) {
btn.classList.add('active');
btn.nextElementSibling.classList.add('open');
}
});
</script>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
<!-- :
{
"@type": "Question",
"name": "",
"acceptedAnswer": {
"@type": "Answer",
"text": ""
}
}
-->
]
}
</script>