如何在资金内使用sweetalert2?

问题描述 投票:2回答:1

我正在使用最新版本的sweetalert sweetalert2,我怎么能在模特里面打电话给sweetalert?警报显示但它实际上被模态阻止,结果我得到.result

它实际上被模态阻挡了,我能做些什么才能让它成为前线?谢谢!

        swal({
        title: "Are you sure?",

        type: "warning",
        confirmButtonText:"Yes",
        confirmButtonColor:"#18a689",
        cancelButtonText:"No",
        showCancelButton: true,
        showLoaderOnConfirm: true
    }).then( function () {
        $.ajax({
            url: [[@{/jobDetails/remove}]],
        type: "POST",
            data:{jobId:id,masterId:masterListId},
        success: function (result) {
            if (result=="success"){
                refreshJobDetails(masterListId)
                reWriteMainTable();
            }
        },
        error: function (thrownError) {

        }
    });
    })
jquery bootstrap-modal sweetalert sweetalert2
1个回答
5
投票

我相信你的问题是关于z-index CSS属性。

SweetAlert2的容器默认有z-index: 1060。为了增加它,你需要在CSS样式中使用这样的东西:

.swal2-container {
  z-index: {X};
}

其中{X}是一个大于另一个模态的z-index的数字,例如100000

© www.soinside.com 2019 - 2024. All rights reserved.