2017-01-02 82 views
1

需要在模式区域之外的半透明背景。我得到的帽子是不透明的白色区域。背景设置背景:虚假工作。

var confirmInstance = $uibModal.open({ 
    animation: true, 
    ariaLabelledBy: 'modal-title', 
    ariaDescribedBy: 'modal-body', 
    templateUrl: 'abc.html', 
    size: 'sm', 
    backdrop: false, 
    controller:function($uibModalInstance){ 
       this.cancel = function() { 
        $uibModalInstance.dismiss('cancel'); 
       }; 
       this.ok=function(){ 
       } 
    }, 
    controllerAs:'$ctrl', 
    resolve: { 
       items: function() { 
       console.log("In resolve"); 
      } 
    } 
    }); 

下面是模式的我的HTML代码:

<div><h1>Welcome here.. doing some more displaying stuff</h1></div> 
     <script type="text/ng-template" id="abc.html"> 
      <div class="modal-header"> 
      Remove {{$ctrl.type}} 
       <button type="button" class="close" data-dismiss="modal" ng-click="$ctrl.cancel()">&times;</button> 
      </div> 
      <div class="modal-body" id="modal-body"> 
       <p>Confirm request for removal of {{$ctrl.type}} {{$ctrl.name}}?</p> 
      </div> 
      <div class="modal-footer"> 
       <button class="btn-revoke" type="button" ng-click="$ctrl.ok()">Ok</button> 
       <button class="btn-cancel" type="button" ng-click="$ctrl.cancel()">Cancel</button> 
      </div> 
     </script> 
+0

在演示网站中正常工作,因此创建了一个重现问题的重陷。见[mcve] – charlietfl

+0

是的,同样的例子在plunker中工作正常。那么为什么不在这里。 – FalconFlyer

+0

你必须有不同的css或css冲突。需要检查适用于您的浏览器中的重叠规则的工具elemetns inspector – charlietfl

回答

1

删除背景:false。因为默认行为是显示半透明背景。

+0

是啊为我工作:)! – FalconFlyer

0

你在寻找的是所谓的“不透明度” CSS属性,你只需要创建一个类本和类添加到所需的元件:

.className { 
    opacity: 0.5; 
} 

不透明度设置好的在0.5会使元件半透明的,所以仍然可以欣赏它但你可以透过它看到。

对于这里更多的文件你有官方网站:http://www.w3schools.com/cssref/css3_pr_opacity.asp

希望它能帮助!

+0

因此,我应该在哪里添加,您是否可以演示。 – FalconFlyer