1

我希望仅使用 div、ng-class、ng-style 和 css3 样式来禁用弹出窗口和背景屏幕。我不想使用引导模式。我一直在努力完成这项工作。我正在尝试显示和隐藏弹出窗口,但它所做的只是禁用屏幕而不显示弹出窗口。下面是代码

html代码

<div id="popupBackGround" class="popupModal-backdrop" ng-if="newUser===true" ng-style="{'display': (newUser===false || newUser===undefined) ? 'none':'block'}">
<div id="popupBackGroundDialog" class="popupModal-dialog">
    <div class="popupModal-content">
        <div class="popupModal-body">
           <p style="margin-left: 20px;">
                            <strong>Is this user transferring from another Dept?</strong>
           </p>
           <p style="margin-left: 40px;">
                <input ng-click="" name="transfer" value="Yes" type="radio"> <strong>Yes</strong>
           </p> 
           <p style="margin-left: 40px;">
                <input ng-click="" name="transfer"  value="No" type="radio"> <strong>No</strong>
          </p>
          <p align= "center">
          <button class="btn btn-primary" ng-click="ok()">OK</button>
          </p>
        </div>                          
    </div>
</div>
</div>

CSS 代码

.popupModal-dialog {
  position: absolute;
  width: 40%;
  margin-left: 400px;
  margin-right: 400px;
  margin-top: -430px;
  opacity: "0"
}
.popupModal-content {
  position: relative;
  background-color: #ffffff;
  border: 1px solid #999999;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
  background-clip: padding-box;
  outline: none;
}
.popupModal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  background-color: #000000;
  display: none;
  opacity: 0.5;
  filter: alpha(opacity=50);
}
.popupModal-body {
  position: relative;
  padding: 20px;
} 

任何帮助,将不胜感激

4

1 回答 1

1

我会简化一点——你似乎有两种机制在做同样的工作(ng-ifng-style)。

<div ng-app>
  <button ng-click="showModal=1">Show modal</button>

  <div id="popupBackGround" class="popupModal-backdrop" ng-if="showModal"></div>

  <div id="popupBackGroundDialog" class="popupModal-dialog" ng-show="showModal">
    <div class="popupModal-content">
      <div class="popupModal-body">
        <p style="margin-left: 20px;">{{showModal}}</p>
        <p>
          <button ng-click="showModal=0">Hide modal</button>
        </p>
      </div>
    </div>
  </div>
</div>

演示

我也简化了你的 CSS。

于 2016-02-05T18:32:43.323 回答