繁体   English   中英

当用户在JQuery UI中的模式对话框之外单击时,如何防止模式对话框关闭?

[英]How do you prevent Modal dialog from closing when users clicks outside of the modal dialog box In JQuery UI?

我被困在一个使用Jquery UI在视图上显示Modals的旧项目中。 我遇到的问题是,当用户在“ Model Dialog之外单击时,对话框模式视图将关闭。 Jquery中有一个属性可以防止这种情况? 我知道Bootstrap中的Boostrap和keyboard属性将有助于Boostrap防止外部点击关闭模态,但是Jquery UI会是什么情况?

以下是我的Javascript代码:

// EDit Dialog
var updateBanquetTicketDialog = function () {
    var s = $('<div></div>').dialog({
        title: "Edit Banquet Ticket",
        autoOpen: false,
        dialogClass: "success-dialog",
        modal: true,

        buttons: [
           {
               text: "Update"
             , 'class': "btn-primary"
             , click: function () {
                 updateBanquetTicket();
             }
           },

          {
              text: "Cancel"
             , 'class': "btn-warning"
             , click: function () {
                 editBanTicketDiag.dialog('destroy');
             }

          }
        ]

    });
    return s;
}

我想到了。 您必须转到jquery.dialog.js文件

在show function的第117行,将其代码替换为:

var show = function () {
//call the bootstrap modal to handle the show events (fade effects, body class and backdrop div)
            //$msgbox.modal('show');
            $msgbox.modal({
                show: true,
                backdrop: 'static',
                keyboard: true
            });
        };

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM