Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Modal - resize modal based on iframe height [duplicate]

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

like image 408
captainrad Avatar asked Sep 21 '25 05:09

captainrad


1 Answers

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.

like image 156
Stephen Thomas Avatar answered Sep 22 '25 19:09

Stephen Thomas