From db3fff084146f8789979829708b8ef44b428ba27 Mon Sep 17 00:00:00 2001 From: Rafael Matias Date: Mon, 14 Oct 2024 15:41:50 +0200 Subject: [PATCH] fix modal zindex to not colide with header --- static/js/common.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/static/js/common.js b/static/js/common.js index 12005bee..8f61365d 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -1,6 +1,11 @@ // Fix bootstrap backdrop stacking when having multiple modals $(document).on('show.bs.modal', '.modal', function() { - const zIndex = 10 + Math.max(...Array.from(document.querySelectorAll('*')).map((el) => +el.style.zIndex)); + const zIndex = 1000 + Math.max(...Array.from(document.querySelectorAll('*')).map((el) => +el.style.zIndex)); $(this).css('z-index', zIndex); setTimeout(() => $('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack')); }); + + // Fix bootstrap scrolling stacking when having multiple modals + $(document).on('hidden.bs.modal', '.modal', function(){ + $('.modal:visible').length && $(document.body).addClass('modal-open') + });