marcelodolza / iziModal

Elegant, responsive, flexible and lightweight modal plugin with jQuery.
http://marcelodolza.github.io/iziModal/
Apache License 2.0
2.16k stars 285 forks source link

Auto height on iframe iziModal #146

Open stiegenaufgang opened 7 years ago

stiegenaufgang commented 7 years ago

I would like to have a iziModal for a iframe that works like the "Large Content" example on your website. I tried to achieve that, but the height is not changing and scrolling doen't work. Am I doing something wrong or is this behaviour not possible for iframe iziModals.

$(".testclass").iziModal({
   title: 'Header',
   history: false,
   iframe : true,
   closeButton: true,
   fullscreen: true,
   width: 800,
   iframeHeight: 800,
   group: 'group1',
   loop: true
});
ghost commented 6 years ago

Would be very nice if this worked yes. Currently i am even unable to change iframe height, it gets reset right after to initial height.

does not work because of height reset function resizeIframe(iframeID) { var iframe = window.parent.$(".iziModal-iframe") var container = $(".content"); iframe.css("height",container.height()) }

mirkotnn commented 2 years ago

onClosed: function () { if (window.iziModal_Interval != undefined) clearInterval(window.iziModal_Interval); }, onOpened: function (modal) { var $iframe = $('iframe.iziModal-iframe'); var hIframe = modal.options.iframeHeight; window.iziModal_Interval = setInterval(function () { var new_hIframe = $iframe.contents().find('body').outerHeight(); if (hIframe != new_hIframe && new_hIframe > 0) { hIframe = new_hIframe; modal.options.iframeHeight = hIframe; } }, 100); }