Bootstrap Modal Opacity仅适用于特定的div而非整个身体

时间:2015-12-17 07:04:18

标签: javascript jquery html css twitter-bootstrap

我正在尝试在Modal属性中应用编辑引导程序构建...我想申请不透明度仅指定div不是为了整体(默认)我们如何解决这个问题?

<div class="container">

  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <p>Some text in the modal.</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>

    </div>
  </div>

</div>
 <div class="change_me" id="changeme1">
 some div content
 </div>

当点击Open Modal弹出窗口打开时,将body的css属性更改为opacity:0.6,但我尝试仅为类.change_me应用不透明度,我们怎样才能实现此目的?

1 个答案:

答案 0 :(得分:2)

我认为你的意思是你不需要所有的身体显示不透明度,只为div.change_me,你可以设置这个:

.modal-backdrop, .modal-backdrop.fade.in {
     opacity: 0!important;
     filter: alpha(opacity=0)!important;
 }

设置你div.​​change_me:

.change_me{
      opacity: 0.6!important;
      filter: alpha(opacity=60)!important;
 }

然后让div.change_me在正确的位置;(编辑错误的数字;)