TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 500
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 450
  • Total: 450

iframe autosize vertically ?

Started by thefunkyone, March 18, 2007, 04:36:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

thefunkyone

Hiya im having problems trying to get an iframe to autosize vertically.....

I have tried G6's code from this thread..
http://www.tinyportal.net/index.php?topic=11744.0

And i tried the iframe code from this thread...
http://www.tinyportal.net/index.php?topic=1359.0
<IFRAME src="http://www.mywebsite.com/download/" width="100%" height="100%" marginwidth=0 marginheight=0 frameborder=0 scrolling=no></IFRAME>

Now both codes seem to work good, and autosize horizontal perfectly, but the article ends up squished into a vertically small box.. I can set the frames to work for a specific height and enable scrolling, but i was wondering if there is any way to get it so that the frame will autosize vertically as i think that would make things look a bit more integrated....

I would appreciate any ideas to this problem.....

Ken.

I use the code by G6 on most all of my iframe stuff and it has always worked very well, however after my forum was updated to SMF 1.1.2 it has been a little off sometimes with the vertical not always working as expected.

In my experience if vertical is off then horizontal will likely be off as well. One thing to check if your article is being ââ,¬Ëœsquishedââ,¬â,,¢ is the relationship between the article window and whatever else you have showing on the pageââ,¬Â¦ as an example if you have both left and right blocks showing with your article that might squeeze the article or maybe even overlap part of the article. That has happened to me with slide shows making part of the slide go under the right blocks.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

thefunkyone

thanks......  I just tried disableing all blocks and i even tried disabling the "title/frame" from theme options and the iframe still remains the squished size  :(

ohh i forgot to mention im running smf 1.1.2 & TP 0.9.7

Ken.

You could try playing with the "width="100%" setting, change it to 99% or to a fixed value to see if that helps any.

Also, you may have some other issue and may need a response from someone who knows more about theme issues than I do.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

thefunkyone

i just tried playing with the width, still no joy.... And i checked all the themes, and the problem still happens with them all.....


very strange !!!!  :-\

thanks again for your help !!! :)

G6Cad

for some reason i culd just get this to work with removing the % at the hight.
Try removing the % there and set it to 900 or something to test and see if it loads up the page
Then you have to play with the value there so you get it to look good

thefunkyone

i can get the height to work by manually setting it to a specific height.... What i was trying to do was get the frame to auto adjust the frame height to match the size of the browser window (like it does with the width), so that people with high monitor resolutions wouldnt have much wasted space (since i will have to have it set for the most common res of 1024x768).... Is it remotely (or technically) possible to do this ?

Ken.

What I've done with mine is continue to use the 'auto-resize' code but when one gives me problems just change the value for the verticle scroll bars to 'yes'. (close to the end of the code)

My article for WordPress works OK set at 'no', but my gallery needs it set to 'yes' to work right... not figuring out why yet.

http://www.mykimbrell.com/FamilyForum/index.php?action=Coppermine
http://www.mykimbrell.com/FamilyForum/index.php?action=WordPress
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

thefunkyone

Heres what happens when i use the G6 Autosize code with vertical scrollbars enabled....

http://www.agmforums.com/forum/index.php?page=38

See what i mean by the squishedness !!!

Heres the codeing....
<script type="text/javascript">

/***********************************************
* IFrame SSI script II- Ã,© Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids)
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids] : document.getElementById(iframeids)
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>

<iframe id="myframe" src="http://www.adultgamemods.com/download/" marginwidth="0" marginheight="0" vspace="0" hspace="0" style="width: 100%; display: none;" frameborder="0" scrolling="yes"></iframe>

This website is proudly hosted on Crocweb Cloud Website Hosting.