繁体   English   中英

如何在角度UI引导程序中自定义模式宽度

[英]how to customize modal width in angular UI bootstrap

到目前为止,要裁切模态宽度我已经做到了

     var modalInstance = $modal.open({
        animation: $scope.animationsEnabled,
        templateUrl: 'AddProtocolElement',
        controller: 'ProtocolElementDialogController',
        backdrop: 'static',
        size: 'lg',
        resolve: {
            items: function () {
                return $scope.items;
            }
        }
    });

并覆盖其模态lg属性为

    .modal-lg{
    width:1100px !important
    }

很好,但是现在我需要的是在同一屏幕上具有多个自定义lg尺寸的模态。 这是HTMl

    <script type="text/ng-template" id="AddProtocolElement">
                        <form name="elementForm" id="elementForm" action="#" novalidate class="form-horizontal" role="form">
                            <div class="modal-header ">
                                <h3 class="modal-title">{{formHeading}} Protocol Element</h3>
                            </div>
                            <div class="modal-body">

                            <!-- here goes the body -->
                            </div>



                            <div class="modal-footer ">
                                <!-- here goes the footer -->        

                            </div>

                        </form>

要通过添加到CSS来调整模态,请执行以下操作:

.adjustwidth .modal-dialog{
   width: 5000px; 
  }

然后将该类添加到实例化模态的windowClass属性中

var modalInstance = $modal.open({
    animation: $scope.animationsEnabled,
    templateUrl: 'AddProtocolElement',
    controller: 'ProtocolElementDialogController',
    backdrop: 'static',
    windowClass: 'adjustwidth',
    size: 'lg',
    resolve: {
        items: function () {
            return $scope.items;
        }
    }
});

在JavaScript中尝试width = 150px 这应该在没有jQuery的情况下工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM