Jump to content

Recommended Posts

I dont know whether this will be more CSS or javascript, but here goes.

 

I have a page and when you click on a link, it opens a floating div 1000px wide which contains another page in an iframe. The problem I have is, each page is a different height so I can't just set a height to the iframe. I have used abit of javascript which I have put in the parent page.

<script language="JavaScript"> 
  <!--
  function calcHeight()
  {
//find the height of the internal page
var the_height=
document.getElementById('resize').contentWindow.
document.body.scrollHeight;

//change the height of the iframe
document.getElementById('resize').height=
the_height;
}
//-->
</script>

 

This works to an extent, but on my pages, there are divs, that it doesn't seem to pick up the height for, causing me to use <BR> hacks to push page down. Also there are hidden divs that appear when buttons pressed, which pushs the page down, but this does not cause the iframe to change height as required, and pushs some of the content out the iframe, which has scrolling OFF, so cant be accessed.

 

Any ideas on the best way to approach this problem?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/178713-floating-divs-iframes-and-javascript/
Share on other sites

<iframe src="journeys.html" onLoad="calcHeight();" scrolling="NO" frameborder="1" width="760" height="200" name="resize" id="resize"><div style="clear:both"></div></iframe>

 

is now what my iframe looks like but with no success or changes.

 

Nope, that made no effect at all. I'm going to have to give up and just let it look tacky with a scroll bar aren't i :(

 

Is there anyway in which case, of if the iframe scroll is set to auto, and the page requires scrolling... the scrollbar for the entire page is disabled while the floating div is visible.

<iframe src="journeys.html" onLoad="calcHeight();" scrolling="NO" frameborder="1" width="760" height="200" name="resize" id="resize">

 

<div>

      <div style="float: left">

            the page

      </div>

<div style="clear:both"></div>

</div>

 

</iframe>

I'm going to have to give up and just let it look tacky with a scroll bar aren't i :(

 

Perhaps think about why you never see other pages with scroll bars in the middle? There are many other methods to *including* content into a template, without the use of frames or having to update 20 pages for a single change.

 

Take a look at PHP includes (personally I prefer require_once to include files).

The div holding the iframe is floating, to appear like a pop up in sense.. it loads up their control panel. I'm iframing in from another server where the portal is held. So can't use include.

 

I'm going to have to give up and just let it look tacky with a scroll bar aren't i :(

 

Perhaps think about why you never see other pages with scroll bars in the middle? There are many other methods to *including* content into a template, without the use of frames or having to update 20 pages for a single change.

 

Take a look at PHP includes (personally I prefer require_once to include files).

here it is

www.bigggg.com/iframe.html

 

notice how it works now the first time you click on the graph symbol. if you then click on the "october" link.. then go back in browser... or reload the website... the iframe doesn't adjust no more..

 

iv used fusion charts many times befre and i had the problem solved but i just dont have teh code, what iv given you is what i started off from  to reach teh solution., when i used the charts they were all over the place, there are issues with SPACES and floating.

so you think ur bad with ur javascript hahahaha

what u mean?

 

as in you are very proud of the javascript you have done but i think you should use a framewok, if your gona be having buttons that change content in the current document you need more interactive responses from the interface, and maybe they will have popups that will hot it properly

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.