Modal without fade transition has opaque black backdrop
When I open a modal window on Bootstrap 3 the backdrop of the rest of the page becomes black (or very dark grey). I found that the modal-backdrop was responsible for this as it didn't have an opacity set.
I used the simplest example with opening a modal window through the use of
<a data-toggle="modal" href="#" data-target="#modal-1">open</a>
referring to my model with id modal-1 on the same page.
.modal-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1030;
background-color: #333333;
opacity:0.8; // I ADDED THIS LINE
}
}
Maybe it is intential to have a dark full color backdrop, but it looks crappy and takes away the visibility of the drop shadows of the modal itself.
I get a translucent medium gray as the backdrop in the current docs: http://twbs.github.io/bootstrap/javascript/#modals-examples
What browser and OS are you using?
I use Windows Vista (I know..) and tested in IE 9 and Firefox 22
Do you experience this problem in the docs too, or just on your own page?
Only on my own page so far. It seems my pages uses the .modal-backdrop class and when I analyse the docs it seems to be using hte .modal-open class
@AREALFAKE Have you tried class="modal fade" ? Let me know.
See the html example page below.
http://jsfiddle.net/N3PhG/3/
I took the liberty of porting your example to a jsFiddle.
OK, I can now repro your problem with the example. But it works in the docs, so the problem should be in your markup somewhere...
Problem is the lack of .fade on the div.modal. I'll fix the docs...
Many thanks! Would have taken me ages to find such a little thing!
Shouldn't the modal work even without the fade class (less the transition)?
In modals.less, I don't see a default opacity style set for the .modal-backdrop. This causes the backdrop issue seen here.
Note that the modal works [without transition] as expected, but the backdrop is fully opaque. This is obviously undesirable and also different from BS2.
I think in the Bootstrap 2 we had the option to remove the "fade" and the opacity in the modal backdrop still worked correctly. Can removing the fade still respect the opacity?
When I delete these styles from bootstrap.css the modal opacity and fade work normally.
Line 5889 .fade { opacity: 0; -webkit-transition: opacity 0.15s linear; transition: opacity 0.15s linear; } .fade.in { opacity: 1; }
Was this fixed in v3.0.0? I am using the version from bootstrapcdn:
//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.no-icons.min.css
The modal backdrops are still completely black.
@julianlam The CDN's no-icons versions are fubared due to #10030.
Thanks for pointing me in the right direction! :+1:
@julianlam See also https://github.com/netdna/bootstrap-cdn/issues/166
I had the same problem, I also removed the same code as @1nspire and now I get the faded background.
Another fix is to add fade to this style in your custom.css. Line 5098 in the bootstrap.css file.
.modal-backdrop.fade.in { opacity: 0.5; filter: alpha(opacity=50); }
I still have this issue with netdna host CSS.