I'm making a page that uses modal over modal (click the button, opens modal and when you click the button inside that modal opens another).
I was doing this with bootstrap 3.3.7, BUT I now migrated to version 4 and where I had modal on modal is now working strange, the secondary modal is opening behind the primary ...
I did not find anything on the internet with multiple bootstrap 4 modes, just 3 ...
I had to use a css to show the modal
.fade.in {
opacity: 1;
}
.modal.in .modal-dialog {
-webkit-transform: translate(0, 0);
-o-transform: translate(0, 0);
transform: translate(0, 0);
}
.modal-backdrop .fade .in {
opacity: 0.5 !important;
}
.modal-backdrop.fade {
opacity: 0.5 !important;
}
I tried to use this ..
$(document).on('show.bs.modal', '.modal', function () {
var zIndex = 1040 + (10 * $('.modal:visible').length);
$(this).css('z-index', zIndex);
setTimeout(function() {
$('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack');
}, 0);
});
try practically everything else from version 3: /