Jump to content

floating divs, iframes and javascript :(


jotgabbi

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
Share on other sites

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.