mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2025-01-15 19:23:58 +01:00
Solved close modals bug
This commit is contained in:
parent
e303968ca5
commit
a9fcd4b6de
@ -1,4 +1,7 @@
|
|||||||
function openDynamicPopup(subitem) {
|
function openDynamicPopup(subitem) {
|
||||||
|
// Schließe alle offenen Modals
|
||||||
|
closeAllModals();
|
||||||
|
|
||||||
// Setze den Titel
|
// Setze den Titel
|
||||||
document.getElementById('dynamicModalLabel').innerText = subitem.description;
|
document.getElementById('dynamicModalLabel').innerText = subitem.description;
|
||||||
|
|
||||||
@ -76,3 +79,22 @@ function openDynamicPopup(subitem) {
|
|||||||
const modal = new bootstrap.Modal(document.getElementById('dynamicModal'));
|
const modal = new bootstrap.Modal(document.getElementById('dynamicModal'));
|
||||||
modal.show();
|
modal.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeAllModals() {
|
||||||
|
const modals = document.querySelectorAll('.modal.show'); // Alle offenen Modals finden
|
||||||
|
modals.forEach(modal => {
|
||||||
|
const modalInstance = bootstrap.Modal.getInstance(modal);
|
||||||
|
if (modalInstance) {
|
||||||
|
modalInstance.hide(); // Modal ausblenden
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Entferne die "modal-backdrop"-Elemente
|
||||||
|
const backdrops = document.querySelectorAll('.modal-backdrop');
|
||||||
|
backdrops.forEach(backdrop => backdrop.remove());
|
||||||
|
|
||||||
|
// Entferne die Klasse, die den Hintergrund ausgraut
|
||||||
|
document.body.classList.remove('modal-open');
|
||||||
|
document.body.style.overflow = '';
|
||||||
|
document.body.style.paddingRight = '';
|
||||||
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" onclick="closeAllModals()">Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user