Bootstrap 3 modal vertical position center

后端 未结 30 1211
天涯浪人
天涯浪人 2020-11-28 00:15

This is a two part question:

  1. How can you position the modal vertically in the center when you don\'t know the exact height of the modal?

  2. Is

30条回答
  •  庸人自扰
    2020-11-28 01:02

    i have downloaded bootstrap3-dialog from bellow link and modified the open function in bootstrap-dialog.js

    https://github.com/nakupanda/bootstrap3-dialog

    Code

    open: function () {
                !this.isRealized() && this.realize();
                this.updateClosable();
                //Custom To Vertically centering Bootstrap 
                var $mymodal = this.getModal();
                $mymodal = $mymodal.append('
    '); $mymodal = $mymodal.find(".modal-dialog").appendTo($mymodal.find(".centerModal")); //END this.getModal().modal('show'); return this; }

    Css

    .centerModal .modal-header{
        text-align:left;
    }
    .centerModal .modal-body{
        text-align:left;
    } 
    

提交回复
热议问题