I have a custom sized (80% height width) bootstrap modal body and it scrolls (body content will overflow on some sized screens)
There are 2 problems:
As a follow up to pwnna's answer this code is working better for me as it's working with a variable height depending on the content size with a max-height as well and it runs on load too, instead of just resize.
//adjust modal body sizes
var fit_modal_body;
fit_modal_body = function(modal) {
var body, bodypaddings, header, headerheight, height, modalheight;
header = $(".modal-header", modal);
footer = $(".modal-footer", modal);
body = $(".modal-body", modal);
modalheight = parseInt(modal.css("height"));
headerheight = parseInt(header.css("height")) + parseInt(header.css("padding-top")) + parseInt(header.css("padding-bottom"));
footerheight = parseInt(footer.css("height")) + parseInt(footer.css("padding-top")) + parseInt(footer.css("padding-bottom"));
bodypaddings = parseInt(body.css("padding-top")) + parseInt(body.css("padding-bottom"));
height = $(window).height() - headerheight - footerheight - bodypaddings - 150;
return body.css({"max-height": "" + height + "px", 'height':'auto'});
};
fit_modal_body($(".modal"));
$(window).resize(function() {
return fit_modal_body($(".modal"));
});