-
-
Save myasseen/e5a93ad6a6887087d549 to your computer and use it in GitHub Desktop.
Fix "backdrop" height on tall modal in Bootstrap (require jQuery)For tall modals in Bootstrap, the backdrop (background) doesn't always go all the way down because of how Bootstrap is setting the height.Instead, set the backdrop height equal to the modal-content and correct for the window height.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('body').on('shown.bs.modal', '.modal', function(){ | |
var windowHeight = parseInt($(window).height()); | |
var height = parseInt($('.modal-content').height()); | |
if(windowHeight > height) height = windowHeight; | |
//the 60 ekstra pixels is to correct for the margin top and button of the modal when initiated | |
$('.modal-backdrop').height(height+60); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment