Skip to content

Instantly share code, notes, and snippets.

@aleckyann
Created September 15, 2021 13:16
Show Gist options
  • Save aleckyann/3278b73157f37d216010f3ee806a16d7 to your computer and use it in GitHub Desktop.
Save aleckyann/3278b73157f37d216010f3ee806a16d7 to your computer and use it in GitHub Desktop.
$(document).on("show.bs.modal", '#ID_DO_SEU_MODAL', function (event) {
var zIndex = 100000 + (10 * $("#ID_DO_SEU_MODAL:visible").length);
$(this).css("z-index", zIndex);
setTimeout(function () {
$("#ID_DO_SEU_MODAL-backdrop").not("#ID_DO_SEU_MODAL-stack").first().css("z-index", zIndex - 1).addClass("modal-stack");
}, 0);
}).on("hidden.bs.modal", '#ID_DO_SEU_MODAL', function (event) {
$("#ID_DO_SEU_MODAL:visible").length && $("body").addClass("modal-open");
});
$(document).on('inserted.bs.tooltip', function (event) {
var zIndex = 100000 + (10 * $("#ID_DO_SEU_MODAL:visible").length);
var tooltipId = $(event.target).attr("aria-describedby");
$("#" + tooltipId).css("z-index", zIndex);
});
$(document).on('inserted.bs.popover', function (event) {
var zIndex = 100000 + (10 * $("#ID_DO_SEU_MODAL:visible").length);
var popoverId = $(event.target).attr("aria-describedby");
$("#" + popoverId).css("z-index", zIndex);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment