2024-01-16 00:23:27 +01:00
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
2024-01-18 15:19:34 +01:00
|
|
|
const faqelements = document.querySelectorAll('.faq-element');
|
2024-01-16 00:23:27 +01:00
|
|
|
|
2024-01-18 15:19:34 +01:00
|
|
|
faqelements.forEach(element => {
|
|
|
|
const questionBtn = element.querySelector('.faq-question-btn');
|
2024-01-16 00:23:27 +01:00
|
|
|
|
|
|
|
questionBtn.addEventListener('click', () => {
|
|
|
|
// Ferme toutes les autres réponses
|
2024-01-18 15:19:34 +01:00
|
|
|
faqelements.forEach(otherelement => {
|
|
|
|
if (otherelement !== element) {
|
|
|
|
otherelement.classList.remove('active');
|
|
|
|
otherelement.querySelector('.faq-reponse').style.display = 'none';
|
2024-01-16 00:23:27 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Affiche ou masque la réponse de la question actuelle
|
2024-01-18 15:19:34 +01:00
|
|
|
element.classList.toggle('active');
|
|
|
|
const reponse = element.querySelector('.faq-reponse');
|
|
|
|
reponse.style.display = element.classList.contains('active') ? 'block' : 'none';
|
2024-01-16 00:23:27 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|