I need to resize this bootstrap
modal based on the height of the iframe
content because it is dynamic.
Using an onload
and the following function I am getting nothing.
window.resizeIframe = function () {
var frame = $('#custom-frame');
var modalHeight = $('#custom-frame').contents().height();
frame.height(modalHeight);
$(window).resize(function() {
frame.height(modalHeight);
});
};
I've provided a plunker: http://plnkr.co/edit/eElqXJwvxmpc1XMrdwIK?p=preview
Unless you set it explicitly using a height
attribute (which you're not doing), the height of an <iframe>
defaults to 150px. Before setting the modal height, you'll need to set the <iframe>
height. Some information in this question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With