Bootbox, two modal windows - one above another

半城伤御伤魂 提交于 2020-01-04 13:48:09

问题


I have two bootbox modal windows - parent and child. If user enters wrong data and try to save the parent modal window, the child window appears. The problem is - when the child window appears, it's still possible to click on the parent modal window buttons. How can I fix it? The parent window controls must be disabled when the child modal opened.

Thanks a lot,

Michael


回答1:


Nice! Thanks a lot! But solution is more simple.. I changed the z-index of the above window. Example: z-index of the parent window is 1050. I've added style to my css file with following rows: //div.bootbox.modal.fade... is the child modal window

    div.bootbox.modal.fade.in {
         z-index:1070;
 }

//div.bootbox.modal.fade.in + div - is the next div that fades the body

div.bootbox.modal.fade.in + div {
     z-index:1060;
 }

Thanks a lot!

Michael




回答2:


parent=bootbox.dialog(/*your code*/);

put following code in callback of button creating child modal

parent.find('button').prop("disabled",true);

put following code in callback of closing callback

parent.find('button').prop("disabled",false);

eg.

$('button calling child').click(function(e)
{    
    parent.find('button').prop("disabled",true);
   bootbox.dialog(
   {
    main:
      {
        callback:function(e)
        {
           parent.find('button').prop("disabled",false);
        }
      }
    });
});


来源:https://stackoverflow.com/questions/20521605/bootbox-two-modal-windows-one-above-another

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!