Skip to content

Instantly share code, notes, and snippets.

@ki11ua
Created November 29, 2017 11:11
Show Gist options
  • Save ki11ua/ea1987ee3e60c5934c3bb8a4878cffe7 to your computer and use it in GitHub Desktop.
Save ki11ua/ea1987ee3e60c5934c3bb8a4878cffe7 to your computer and use it in GitHub Desktop.
Fix for jump on top ( Bootstrap Modal - Fixed 100% height + width)
html{
overflow-x: hidden
}
body.modal-open{
overflow: visible !important
padding-right: 0 !important
}
.modal.full-size {
position: fixed !important;
top: 0;
right: 0;
bottom: 0;
left: 0;
transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0);
}
.modal.full-size .modal-dialog {
position: fixed;
margin: 0;
width: 100%;
height: 100%;
padding: 0;
}
.modal.full-size .modal-dialog .modal-content {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
border-radius: 0;
box-shadow: none;
}
.modal.full-size .modal-dialog .modal-content .modal-body {
position: absolute;
height: 100%;
width: 100%;
font-weight: 300;
overflow: auto;
}
.modal.full-size .modal-dialog .modal-content .modal-body .container-fluid {
height: 100%;
}
<div class="btn show-modal"> Book Now </div>
<div id="bookOnline" class="modal fade full-size" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error recusandae maxime repudiandae rerum molestias, officia provident inventore saepe eaque sint.</p>
</div>
</div>
</div>
</div>
</div>
$(function() {
$(".show-modal").on("click", function(e) {
e.preventDefault();
$('html').css('overflowY', 'hidden');
$(".modal").modal('show');
});
$('.hide-modal').on("click", function(e) {
e.preventDefault();
$('html').css('overflowY', 'auto');
$('.modal').modal('hide');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment