er
This commit is contained in:
parent
9ca80dc507
commit
f600f8f6f6
|
|
@ -128,36 +128,30 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ======================================================= -->
|
||||
<!-- CHARGEMENT DES LIBRAIRIES GRAPHIQUES ET PDF ICI -->
|
||||
<!-- Pour éviter de les recharger à chaque appel Ajax -->
|
||||
<!-- ======================================================= -->
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const collapses = document.querySelectorAll('.accordion-collapse');
|
||||
|
||||
collapses.forEach(collapse => {
|
||||
// Quand une section s'ouvre
|
||||
collapse.addEventListener('show.bs.collapse', function () {
|
||||
const fnName = this.dataset.openFn;
|
||||
if (fnName && typeof window[fnName] === 'function') {
|
||||
window[fnName]();
|
||||
}
|
||||
// Changer l’icône en chevron-up
|
||||
const headerBtn = document.querySelector('[data-bs-target="#' + this.id + '"] .accordion-icon');
|
||||
if (headerBtn) headerBtn.classList.replace('bi-chevron-down', 'bi-chevron-up');
|
||||
// Trouver le bouton lié à ce collapse
|
||||
const headerBtn = document.querySelector('[data-bs-target="#' + this.id + '"]');
|
||||
const icon = headerBtn?.querySelector('.accordion-icon');
|
||||
if (icon) icon.classList.replace('bi-chevron-down', 'bi-chevron-up');
|
||||
});
|
||||
|
||||
// Quand une section se ferme
|
||||
collapse.addEventListener('hide.bs.collapse', function () {
|
||||
const fnName = this.dataset.closeFn;
|
||||
if (fnName && typeof window[fnName] === 'function') {
|
||||
window[fnName]();
|
||||
}
|
||||
// Remettre l’icône en chevron-down
|
||||
const headerBtn = document.querySelector('[data-bs-target="#' + this.id + '"] .accordion-icon');
|
||||
if (headerBtn) headerBtn.classList.replace('bi-chevron-up', 'bi-chevron-down');
|
||||
const headerBtn = document.querySelector('[data-bs-target="#' + this.id + '"]');
|
||||
const icon = headerBtn?.querySelector('.accordion-icon');
|
||||
if (icon) icon.classList.replace('bi-chevron-up', 'bi-chevron-down');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user