css - 如何在 ngx-bootstrap-modal 中添加模糊效果
问题描述
我在我的项目中使用 ngx-bootstrap。
模态的.html
<ng-template #modalMainNotification>
<div class="modal-header">
<h4 class="modal-title pull-left">{{notificationModal.title}}</h4>
<button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div [innerHTML]="notificationModal.content_plus | safeHtml"></div>
</div>
</ng-template>
它在 DOM 中创建组件
<bs-modal-backdrop class="modal-backdrop fade in show"></bs-modal-backdrop>
<modal-container ....></modal-container>
据我了解,我应该这样做filter:blur(2px)
,modal-backdrop
但它没有效果。
模态的.scss
.modal-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: $zindex-modal-backdrop;
background-color: $modal-backdrop-bg;
filter: blur(4px); // no effect
// Fade for backdrop
&.fade { opacity: 0; }
&.show { opacity: $modal-backdrop-opacity; }
}
UPD 1:
作为示例,您可以查看 stackblitz 上的示例之一 -链接
解决方案
我已经通过添加解决了这个问题backdrop-filter: blur(10px);
,modal-container
它对我有用
推荐阅读
- html - 如何使用 thymeleaf 或 Jquery 将参数从模态表单传递到 Spring Controller?
- javascript - 如何从 discord.js 中的 client.users.fetch(id) 获取值
- angular - 可观察 | 从 combineLatest 返回时,异步不维护组件中的数据,并带有 3 个单独的服务调用
- python - 如何在 SqlAlchemy 中使用过滤器扩展部分未知的查询?
- android - 地理编码器 getFromLocation 失败
- python - python中的语音识别模块太慢了
- r - R计算一个值在数据框中出现的次数
- javascript - 从后端rest api下载图像
- python - 使用最佳学习率会导致随机猜测准确度
- ios - 为什么无法设置捆绑 ID?