1

I have a page with two iframe contents which are split horizontally. The left one is a tree view type and its size is initially zero. The right one is shown always. When the size of the content in the right side iframe increases, it creates a scrollbar. The vertical scrollbar is not shown for the iframe, but the browser scrollbar adjusts for the vertical scrolling.

Can the same be done with the horizontal scrollbar? I have the iframes as scrolling=auto; frameborder=0;height=100% etc. Many of the issues i checked are saying like hiding the scrollbar or aligning problem. i cant seem to find something like this. Please advice.

Thanks.

UPDATE

jsFiddle Link

in this link my main content has scroll bar also browser has scroll bar. i just want to use browser's scroll bar not iframe.

Rahul P
  • 1,065
  • 3
  • 17
  • 32
  • please provide a demo to illustrate your problem, you can use [jsFiddle](http://www.jsfiddle.net) for that, attach snapshots if possible, anything that can help clearing the issue. – Eliran Malka Aug 31 '12 at 10:06
  • Will the content in the right iframe be on your domain? Or could it be any website? – Timm Aug 31 '12 at 10:31
  • Working as you want on Mac with Firefox and Chrome. There are two horizontal scrollbars: one for the left pane and other for the page. There is only one scrollbar for vertical movement. When I hide, obviously left pane and it's horizontal scrollbar disappears. – closure Aug 31 '12 at 12:13
  • A suggestion: Say, you want page width of 1000 and left pane width of 200. Toggle the width of right frame to 1000 or 800 based on the left pane visibility. – closure Aug 31 '12 at 12:17

1 Answers1

1

What you need to do is to set the overflow of the inner element to hidden. This is possible using divs and other elements.

Unfortunately, this is not possible inside an iframe. The browser doesn't allow access to inner elements, because this could be a major security flaw, allowing you to inject your code into any page anywhere.

See this fiddle and look the message being logged in the console (better viewed in Firebug in Firefox).

What you can do, however, is to calculate the document height inside the iframe, and set the iframe height accordingly, avoiding the inner scroll bar. See this question.

Cheers, Apoc.

Community
  • 1
  • 1
Apoc
  • 88
  • 1
  • 6