I am opening a modal but when I do this the page behind the modal goes very dark. Can someone explain how I can change this. For example how could I make it so there's just a very light shading on the background.
我正在打开一个模态但是当我这样做时,模态背后的页面变得很暗。有人可以解释我如何改变这一点。例如,我怎么能这样做,所以背景上只有一个非常浅的阴影。
I also notice that when I click the background then my modal disappears. Is there a way I can remove this functionality. I would like my modal to only go away when the user clicks submit or close on the modal itself.
我还注意到,当我点击背景时,我的模态消失了。有没有办法可以删除此功能。我想我的模态只有在用户点击提交或关闭模态本身时才会消失。
3 个解决方案
#1
3
What your looking for is http://twitter.github.com/bootstrap/javascript.html#modals modal backdrop static to disable closing on background click.
您正在寻找的是http://twitter.github.com/bootstrap/javascript.html#modals模式背景静态以禁用关闭背景点击。
Also for the backdrop darkness adjust the
也为背景黑暗调整
.modal-backdrop, .modal-backdrop.fade.in {
opacity: 0;
}
#2
8
If you're looking to keep the backdrop behind the modal but make the backdrop completely transparent, set a transparent background-color instead of changing the opacity:
如果您希望将背景保留在模态背后但使背景完全透明,请设置透明背景颜色而不是更改不透明度:
.modal-backdrop, .modal-backdrop.fade.in { background-color: rgba(0,0,0,0); }
This allows you to be able to click off of your modal and have your modal close while not actually seeing the backdrop.
这使您能够单击模态并使模态关闭而不实际看到背景。
#3
2
If you are using bs 3, you can use data-backdrop="false" attribute in your link so you dont have to modify your base bootstrap files.
如果您使用的是bs 3,则可以在链接中使用data-backdrop =“false”属性,这样您就不必修改基本引导程序文件。
It's in the documentation
它在文档中
#1
3
What your looking for is http://twitter.github.com/bootstrap/javascript.html#modals modal backdrop static to disable closing on background click.
您正在寻找的是http://twitter.github.com/bootstrap/javascript.html#modals模式背景静态以禁用关闭背景点击。
Also for the backdrop darkness adjust the
也为背景黑暗调整
.modal-backdrop, .modal-backdrop.fade.in {
opacity: 0;
}
#2
8
If you're looking to keep the backdrop behind the modal but make the backdrop completely transparent, set a transparent background-color instead of changing the opacity:
如果您希望将背景保留在模态背后但使背景完全透明,请设置透明背景颜色而不是更改不透明度:
.modal-backdrop, .modal-backdrop.fade.in { background-color: rgba(0,0,0,0); }
This allows you to be able to click off of your modal and have your modal close while not actually seeing the backdrop.
这使您能够单击模态并使模态关闭而不实际看到背景。
#3
2
If you are using bs 3, you can use data-backdrop="false" attribute in your link so you dont have to modify your base bootstrap files.
如果您使用的是bs 3,则可以在链接中使用data-backdrop =“false”属性,这样您就不必修改基本引导程序文件。
It's in the documentation
它在文档中