Created
December 18, 2014 09:49
-
-
Save Mestika/6f6679d2c6e9d3e93387 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