GVKun编程网logo

修改bootstrap.js文件使模态框垂直居中显示(bootstrap模态框大小设置)

12

在本文中,我们将带你了解修改bootstrap.js文件使模态框垂直居中显示在这篇文章中,我们将为您详细介绍修改bootstrap.js文件使模态框垂直居中显示的方方面面,并解答bootstrap模态

在本文中,我们将带你了解修改bootstrap.js文件使模态框垂直居中显示在这篇文章中,我们将为您详细介绍修改bootstrap.js文件使模态框垂直居中显示的方方面面,并解答bootstrap模态框大小设置常见的疑惑,同时我们还将给您一些技巧,以帮助您实现更有效的Angular 中修改bootstrap的模态框(modal)大小、AngularJS UI Bootstrap:如何垂直居中模态组件?、bootstrap 3.3 模态框垂直居中问题、bootstrap modal 垂直居中

本文目录一览:

修改bootstrap.js文件使模态框垂直居中显示(bootstrap模态框大小设置)

修改bootstrap.js文件使模态框垂直居中显示(bootstrap模态框大小设置)

总结

以上是小编为你收集整理的修改bootstrap.js文件使模态框垂直居中显示全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

Angular 中修改bootstrap的模态框(modal)大小

Angular 中修改bootstrap的模态框(modal)大小

Angular 中修改bootstrap的模态框(modal)大小



自己瞎搞改width的后果。。。


看官网文档:https://ng-bootstrap.github.io/#/components/modal/examples

https://github.com/ng-bootstrap/ng-bootstrap/blob/master/src/modal/modal.ts


最终解决:

showWarnningModal() {
    this.modalService.open(this.warnningModal,{ size: 'lg' }).result.then((result) => {
      if (result === 'OK') {
        // this.loadTopQueueDeliveryOrder();
      }
    },(reason) => {
      // this.closeResult = `dismissed ${this.getdismissReason(reason)}`;
    });
  }

import { Injector,ComponentFactoryResolver } from '@angular/core';
import { NgbModalStack } from './modal-stack';
import { NgbModalRef } from './modal-ref';
/**
* Represent options available when opening new modal windows.
*/
export interface NgbModalOptions {
/**
* Whether a backdrop element should be created for a given modal (true by default).
* Alternatively,specify 'static' for a backdrop which doesn't close the modal on click.
*/
backdrop ?: boolean | 'static';
/**
* An element to which to attach newly opened modal windows.
*/
container ?: string;
/**
* Whether to close the modal when escape key is pressed (true by default).
*/
keyboard ?: boolean;
/**
* Size of a new modal window.
*/
size ?: 'sm' | 'lg';
/**
* Custom class to append to the modal window
*/
windowClass ?: string;
}
/**
* A service to open modal windows. Creating a modal is straightforward: create a template and pass it as an argument to
* the "open" method!
*/
export declare class NgbModal {
private _moduleCFR;
private _injector;
private _modalStack;
constructor(_moduleCFR : ComponentFactoryResolver,_injector : Injector,_modalStack : NgbModalStack);
/**
* Opens a new modal window with the specified content and using supplied options. Content can be provided
* as a TemplateRef or a component type. If you pass a component type as content than instances of those
* components can be injected with an instance of the NgbActiveModal class. You can use methods on the
* NgbActiveModal class to close / dismiss modals from "inside" of a component.
*/
open(content : any,options ?: NgbModalOptions) : NgbModalRef;
}

AngularJS UI Bootstrap:如何垂直居中模态组件?

AngularJS UI Bootstrap:如何垂直居中模态组件?

最近我正在学习angularjs。我以前使用过引导程序。使用jquery,我可以轻松更改模态组件位置的位置以使其垂直对齐。现在使用angularjs,似乎很难做到这一点。这是ui引导模态的一个庞克链接,有人知道如何使其垂直对齐吗?

ui引导程序模态组件

1.index.html

    <!doctype html>
    <html ng-app="ui.bootstrap.demo">
    <head>
        <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.js"></script>
        <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-animate.js"></script>
        <script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.2.1.js"></script>
        <script src="example.js"></script>
        <link href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <div ng-controller="ModalDemoCtrl">
            <script type="text/ng-template" id="myModalContent.html">
                <div>
                    <h3>I'm a modal!</h3>
                </div>
                <div>
                    This is modal body
                </div>
                <div>
                    <buttontype="button" ng-click="ok()">OK</button>
                    <buttontype="button" ng-click="cancel()">Cancel</button>
                </div>
            </script>
            <button type="button"ng-click="open()">Open me!</button>
        </div>
    </body>
</html>

2.example.js

    angular.module('ui.bootstrap.demo',['ngAnimate','ui.bootstrap']);
    angular.module('ui.bootstrap.demo').controller('ModalDemoCtrl',function($scope,$uibModal,$log) {

        $scope.items = ['item1','item2','item3'];

        $scope.animationsEnabled = true;

        $scope.open = function(size) {

            var modalInstance = $uibModal.open({
                animation: $scope.animationsEnabled,templateUrl: 'myModalContent.html',controller: 'ModalInstanceCtrl',size: size,resolve: {
                    items: function() {
                        return $scope.items;
                    }
                }
            });
        };
    });

    angular.module('ui.bootstrap.demo').controller('ModalInstanceCtrl',$uibModalInstance,items) {
        $scope.ok = function() {
            $uibModalInstance.close($scope.selected.item);
        };

        $scope.cancel = function() {
            $uibModalInstance.dismiss('cancel');
        };
    });

bootstrap 3.3 模态框垂直居中问题

bootstrap 3.3 模态框垂直居中问题

/* center modal */
function centerModals(){
    $(''.modal'').each(function(i){
        var $clone = $(this).clone().css(''display'', ''block'').appendTo(''body'');    var top = Math.round(($clone.height() - $clone.find(''.modal-content'').height()) / 2);
        top = top > 0 ? top : 0;
        $clone.remove();
        $(this).find(''.modal-content'').css("margin-top", top);
    });
}
$(''.modal'').on(''show.bs.modal'', centerModals);
$(window).on(''resize'', centerModals);

bootstrap modal 垂直居中

总结

以上是小编为你收集整理的bootstrap modal 垂直居中全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

我们今天的关于修改bootstrap.js文件使模态框垂直居中显示bootstrap模态框大小设置的分享就到这里,谢谢您的阅读,如果想了解更多关于Angular 中修改bootstrap的模态框(modal)大小、AngularJS UI Bootstrap:如何垂直居中模态组件?、bootstrap 3.3 模态框垂直居中问题、bootstrap modal 垂直居中的相关信息,可以在本站进行搜索。

本文标签: