I'm trying to center a waiting screen modal dialog in the middle of the screen. Here is the modal dialog I'm trying to alter: http://dotnetspeak.com/2013/05/creating-simple-please-wait-dialog-with-twitter-bootstrap. How do I center it horizontally and vertically?
相关问题
- How to add a “active” class to a carousel first el
- Full Clickable Accordion in Bootstrap
- How to add Bootstrap 4 without Tether?
- Laravel overriding bootstrap template
- How to add Labels to Bootstrap dialog footer
相关文章
- Make Bootstrap tab Active on the bases of URL link
- Rails: Twitter Bootstrap Buttons when visited get
- Reduce spacing between rows
- How do use bootstrap tooltips with React?
- Need to design 8 boxes in two rows
- rails 3, how add a simple confirmation dialog when
- Trigger a Bootstrap .collapse('toggle') vi
- How to override Bootstrap mixin without modifying
For standard jQuery/Coffeescript I used:
All credit goes to Sergey Barskiy.
I know it's a little late, but I found the solution to all the problems with centering the Bootstrap Modal with different heights than the standard's (one).
I have met such problem trying to show image (with arbitrary size) in Angular's UI Bootstrap modal. So
I have appended additional class name "width-auto" to a dialog div "modal". (In my case it was done with help of "windowClass" parameter)
I have wrote SCSS code:
.width-auto { &.modal { text-align: center; } .modal-dialog, .modal-content { display: inline-block; width: auto; max-width: 99vw; overflow: hidden; } }
and it solved the problem.
This is just matter of applying some CSS to the
pleaseWaitDialog
ID. You have to setposition:absolute
and themargin-top
andmargin-left
need to be half of the height and width. So your CSS should look something like this:You will need to play with the numbers in order to achieve the box size that fits what you want but that should get you started.
Here is another suggestion, that does not involve hard-coding of margins. it is using Angular, but you can replace element with $. It animates the margin, simulating 'fade" class in bootstrap.