Mestika
12/18/2014 - 9:49 AM

Fix "backdrop" height on tall modal in Bootstrap (require jQuery) For tall modals in Bootstrap, the backdrop (background) doesn't always go

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.

	$('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);
	});