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">×</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:
Thanks for any help
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).
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.
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.
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.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With