How to change background Opacity when bootstrap modal is open

后端 未结 14 2060
慢半拍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:27

    Adding !important to .modal-backdrop will ruin the transition on bootstrap modal

    I achieved changing modal overlay background by direct edit in bootstrap.min.css. Those who are using bootstrap CSS locally (without using CDN) can change the background-color value of .modal-backdrop class.

    If you want to change bootstrap 4 modal overlay opacity find this class .modal-backdrop.show and change opacity to the value you need.

    If want to change overlay transition timing add transition to .modal-backdrop.fade class

    If want to change transition timing for modal object change transition values in .modal.fade .modal-dialog class

提交回复
热议问题