How to change background Opacity when bootstrap modal is open

后端 未结 14 2062
慢半拍i
慢半拍i 2020-12-24 00:37

I am using bootstrap modal. When modal is open background content opacity is not changed by default. I tried changing in js using

function showModal() {
doc         


        
14条回答
  •  伪装坚强ぢ
    2020-12-24 01:10

    Just setting height to 100% won't be the solution if you have a background page whose height extends beyond browser height.

    Adding to Bhargavi's answer, this is the solution when you have scrollable page in the background.

    .modal-backdrop.in
    {
        opacity:0.5 !important;
        position:fixed;// This makes it cover the entire scrollable page, not just browser height
        height:100%;
    }
    

提交回复
热议问题