Angularjs ui bootstrap: how to vertical center modal component?

后端 未结 3 1510
伪装坚强ぢ
伪装坚强ぢ 2021-01-02 02:26

Recently I am learning angularjs. I have used bootstrap before. With jquery, I can easily change the position of the modal component position to make it vertical align. Now

3条回答
  •  粉色の甜心
    2021-01-02 02:54

    You can use windowTopClass property in the object argument for open method.

    https://angular-ui.github.io/bootstrap/

    $uibModal.open({
      ...
      ...
      windowTopClass: "modal-center-override"
    });
    

    with the respective CSS class override

    .modal-center-override {
      top: 50% !important;
      transform: translateY(-50%) !important;
      -webkit-transform: translateY(-50%) !important;
      -moz-transform: translateY(-50%) !important;
      -o-transform: translateY(-50%) !important;  
    }
    

提交回复
热议问题