Is there a way to create a dynamically sizing Iframe with a minimum height?

jakelaux
Kilo Explorer

Hello All,

I have run into an issue while standing up a CMS content page. The page is using an Iframe to display a users requests, however, if the user prompts a window with an action and the window is larger than the Iframe, it gets cut off. Is there a way to either set a minimum height/size for an iframe while letting it be dynamic? Also, is there an easier/more efficient/smoother way to integrate catalogs/requests/knowledge articles/etc... into a CMS site without using Iframes?

Thanks,

        Jake

ReqestsIssue.PNG

4 REPLIES 4

jakelaux
Kilo Explorer

I've found somewhat of a workaround. I'm using bootstrap with my CMS implementation and by placing a HTML defined iframe in the following fashion I can avoid content being clipped by the iframe:


either


<!-- 16:9 aspect ratio -->


<div class="embed-responsive embed-responsive-16by9">


<iframe class="embed-responsive-item" src="…"></iframe>


</div>


or


<!-- 4:3 aspect ratio -->


<div class="embed-responsive embed-responsive-4by3">


<iframe class="embed-responsive-item" src="…"></iframe>


</div>




russell_miller
Kilo Guru

Hi Jacob,



Did you try CSS?



I had a similar problem with the new Knowledge Base v3 pages in the CMS...



Using the frame name I forced the height using a custom style sheet that included this.



iframe#kb_viewer {


  position: fixed;


  height: 100%;


  overflow-y: scroll;


}



Also the new CMS in Geneva is apparently a game changer so I would not worry about developing an alternate to iFrames.



Spend some time on Angular JS instead



Hope that helps.


Great, Thanks Russell!


mloranc
Mega Expert

Hi Jacob,


I ran into a similar problem with the KB V3 clipping off and fixed it with a min-height attribute in a style sheet. Here's my fix:



iframe#knowledge_home { min-height: 950px; }



You may have to adjust the pixel height to meet your needs but that spaced our iframe up with our footer right where we needed it.