gpt4 book ai didi

angularjs - 在不使用 Bootstrap 的情况下使用angularjs禁用弹出窗口的背景

转载 作者:行者123 更新时间:2023-11-28 16:31:41 25 4
gpt4 key购买 nike

我想只使用 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;
}

任何帮助将不胜感激

最佳答案

我会简化一点——您似乎有两种机制来完成相同的工作(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>

Demo

我也确实简化了您的 CSS。

关于angularjs - 在不使用 Bootstrap 的情况下使用angularjs禁用弹出窗口的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35230616/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com