2017-01-02 74 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