【问题标题】:Angular UI modal with Bootstrap 4带有 Bootstrap 4 的 Angular UI 模式
【发布时间】:2017-03-09 08:41:17
【问题描述】:

Bootstrap 3 模式工作正常: https://jsfiddle.net/qLy7gk3f/4/

但 Bootstrap 4 模态不会: https://jsfiddle.net/qLy7gk3f/3/

代码相同:

$scope.click = function() {
  $uibModal.open({
    templateUrl: "modal.html",
    controller: "modal",
    scope: $scope
  });
}

如何让 AngularUI 模式与 Bootstrap 4 一起使用?

【问题讨论】:

  • 添加一些背景.. Angular UI Bootstrap 根本不适合与 Bootstrap 4 (click) 一起使用。正在积极支持模块的 NG2 版本 (click)。
  • @Ankh 谢谢,我已经看到了。但是该线程上的一些人说这是可能的。

标签: angularjs twitter-bootstrap angular-ui twitter-bootstrap-4


【解决方案1】:

我认为这只是添加 .in 类的情况,具体来说:

.fade.in {
    opacity: 1;
}

.modal.in .modal-dialog {
  -webkit-transform: translate(0, 0);
       -o-transform: translate(0, 0);
          transform: translate(0, 0);
}

.modal-backdrop.in {
    filter: alpha(opacity=50);
    opacity: .5;
}

更新的小提琴: https://jsfiddle.net/qLy7gk3f/5/

或者您可以修改 Bootstrap 4 以使用 show 类: https://github.com/angular-ui/bootstrap/issues/4234#issuecomment-285303515

【讨论】:

  • 我知道我应该避免这种情况,但非常感谢!
【解决方案2】:

我通过使用下面的 css 得到了解决方案

.modal.fade.in {
   opacity: 1;
}
.modal.fade .modal-dialog {
   transform: translate(0, 0) !important;
}

.modal-backdrop.fade {
  opacity: 0.5 !important;
 }
.modal-header{
   display: block;
}
.modal-content{
   border-radius: 1.3rem !important;
}

/* Bootstrap 4 的模态 CSS 修复*/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-12-17
    • 1970-01-01
    • 1970-01-01
    • 2018-03-13
    • 2018-03-28
    • 1970-01-01
    • 2014-07-11
    相关资源
    最近更新 更多