This commit is contained in:
KONE SOREL 2026-01-03 11:59:22 +00:00
parent 4f83b4a4be
commit ae3221f220
2 changed files with 29 additions and 13 deletions

View File

@ -98,16 +98,3 @@ foreach ($modals as $id => $cfg):
</div>
</div>
<?php endforeach; ?>
<script>
document.addEventListener('DOMContentLoaded', function () {
const observer = new MutationObserver(() => {
document.querySelectorAll('.modal').forEach(m => {
if (m.parentNode !== document.body) {
document.body.appendChild(m);
}
});
});
observer.observe(document.body, { childList: true, subtree: true });
});
</script>

View File

@ -679,6 +679,35 @@ $activeChildId = $menuData['child'];
}, 1000); // Attendre 1s que tout soit initialisé
});
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
// 1) Pass initial: déplacer tous les modals existants sous <body>
document.querySelectorAll('.modal').forEach(function (m) {
if (m.parentNode !== document.body) document.body.appendChild(m);
});
// 2) Intercepter tous les clics sur triggers avant Bootstrap (capture)
document.addEventListener('click', function (e) {
const trigger = e.target.closest('[data-bs-toggle="modal"][data-bs-target]');
if (!trigger) return;
const targetSelector = trigger.getAttribute('data-bs-target');
const modal = document.querySelector(targetSelector);
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
}, true);
// 3) Fallback: si un modal s'ouvre autrement, garantir le déplacement
document.addEventListener('show.bs.modal', function (event) {
const modal = event.target;
if (modal && modal.parentNode !== document.body) {
document.body.appendChild(modal);
}
});
});
</script>
</body>
</html>