Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
-2
rated 0 times [  3] [ 5]  / answers: 1 / hits: 22925  / 11 Years ago, wed, january 29, 2014, 12:00:00

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


More From » jquery

 Answers
59

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.


[#72860] Tuesday, January 28, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shelbiec

Total Points: 101
Total Questions: 106
Total Answers: 106

Location: Ivory Coast
Member since Fri, Oct 8, 2021
3 Years ago
;