mirror of
				https://github.com/kevinveenbirkenbach/homepage.veen.world.git
				synced 2025-11-04 09:27:58 +00:00 
			
		
		
		
	Solved close modals bug
This commit is contained in:
		@@ -1,4 +1,7 @@
 | 
			
		||||
function openDynamicPopup(subitem) {
 | 
			
		||||
  // Schließe alle offenen Modals
 | 
			
		||||
  closeAllModals();
 | 
			
		||||
 | 
			
		||||
  // Setze den Titel
 | 
			
		||||
  document.getElementById('dynamicModalLabel').innerText = subitem.description;
 | 
			
		||||
 | 
			
		||||
@@ -76,3 +79,22 @@ function openDynamicPopup(subitem) {
 | 
			
		||||
  const modal = new bootstrap.Modal(document.getElementById('dynamicModal'));
 | 
			
		||||
  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 = '';
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user