Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do Modal Bootstrap appear on bottom

How to set up the bootstrap for modal appear in the browser's bottom?

https://jsfiddle.net/9fg7jsu3/

<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Modal test</button>

    <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
      <div class="modal-dialog modal-lg">  
        <div class="modal-content">
           <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="myModalLabel">Modal title</h4>
           </div>
            <p>content</p>
        </div>
      </div>
    </div>

I hope to have a result like this:

enter image description here

Thanks for any help

like image 279
Gislef Avatar asked Jan 24 '16 15:01

Gislef


People also ask

How do you fix modal positions?

You will need to move the DIV outside of the modal. Fixed positioning works in relation to the viewport except when an ancestor element has a transform applied to it. . modal-dialog has transform applied to it which creates a new context in which to position the DIV (this is why your DIV stays inside of the modal).

How do I make modal pop up the center of the screen?

In this example first, use the find() method to find out the modal dialog. Then subtract the modal height from the window height and divide that into half and will place the modal that will be the centered(vertically). This solution will dynamically adjust the alignment of the modal.

How do I get bootstrap modal to center pop up?

Answer: Use the CSS margin-top Property By default, Bootstrap modal window is aligned to the top of page with some margin. But you can align it in the middle of the page vertically using a simple JavaScript trick as described in the example below.

How do you fade a modal in bootstrap?

fade is bootstrap class) which you can use to give your style. . modal. fade . modal-dialog { transform: translate3d(0, 100vh, 0); } //By using 100vh we position it below the screen.


1 Answers

Something like that will do the work. Now you need to play with paddings, margins and width to adjust your modal;

.modal-dialog {
   position:fixed;
   top:auto;
   right:auto;
   left:auto;
   bottom:0;
}  

Use modal-dialog, not modal, otherwise the modal won't disappear if you click above it.

https://jsfiddle.net/9fg7jsu3/2/

like image 159
matvs Avatar answered Oct 21 '22 07:10

matvs