Skip to content

Commit

Permalink
fix modal zindex to not colide with header
Browse files Browse the repository at this point in the history
  • Loading branch information
skylenet committed Oct 14, 2024
1 parent 366885c commit db3fff0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion static/js/common.js
Original file line number Diff line number Diff line change
@@ -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')
});

0 comments on commit db3fff0

Please sign in to comment.