bootstrap css - how to make a modal dialog modal w

2020-05-19 04:32发布

In bootstrap css, it is possible to display a modal dialog, but I want to be able to make it modal so the UI behind doesn't respond, without having the dark black background shown.

There seems to be no options that allow me to do this on the $("#selector").modal() function.

7条回答
男人必须洒脱
2楼-- · 2020-05-19 04:45

I prefer to just hide the backdrop so that you still have that feature of clicking out of the modal to hide it.

.modal-backdrop { opacity: 0 !important; }
查看更多
做个烂人
3楼-- · 2020-05-19 04:52

if I'm correct you should be able to do this by calling:

$("#selector").modal({
    backdrop: "static"
});

then just change the CSS for the class of the backdrop and you're set.

查看更多
干净又极端
4楼-- · 2020-05-19 04:53

To get rid of the backdrop:

After modal initiation

$('#XXX').modal({show:true});

just trigger the code below

 $('.modal-backdrop').removeClass("modal-backdrop");    
查看更多
仙女界的扛把子
5楼-- · 2020-05-19 04:58

The correct way is to pass the param backdrop: false when create the modal

$('#modal').modal({
  backdrop: false
})
查看更多
聊天终结者
6楼-- · 2020-05-19 05:00

Just use the css style as

 .modal-backdrop {background: none;}
 .modal{background: none;}

And all your modal background will go away for every modal you want to display in your app.

查看更多
孤傲高冷的网名
7楼-- · 2020-05-19 05:01

Surey all you need to do is tweak the CSS to change the opacity of the black background. It doesn't have to be visible to block clicks to underlying elements (unless there's some clickjacking protection I don't know about?). The class to target is div.modal-backdrop.

查看更多
登录 后发表回答