• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 511
  • Last Modified:

Hide (or move) automatically a part of an iframe

Hi There!

I was wondering if someone could help me here.

I currently have a page in an iframe but I would like to know if there is a way I can automatically say move the iframe displayed page down?

What I mean here is the page inside my Iframe looks like this
____________
|    menu          | 200px
------------------
|                       |
|      Body         |
|                       |
------------------

I would like it so the Iframe starts at the top of the body (if this is even possible) and not display the menu.

Many thanks!

0
JimmyJack123
Asked:
JimmyJack123
  • 3
  • 2
  • 2
1 Solution
 
abelCommented:
What you should do is to place an anchor on your main body part. Say:

<div id="menu">
...
</div>
<div id="body">
  <a name="body" id="body"></a>
  ..
</div>
then, you can automatically scroll to that part by specifying the link for your iframe as:



0
 
BadotzCommented:
If the menu is a <div>, giv it a unique id, then you can hide it:

window.onload = function() {
document.getElementById('YOUR_DIV_ID_HERE').style.display = 'none';
}

0
 
BadotzCommented:
If it is not a <div>, wrap it in a <div> and give it a unique id, then the above will work.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
JimmyJack123Author Commented:
I think you misunderstood me, I personally dont have control over the iframe website.

What my page looks at the moment is

-------------------------------------
|              my menu                   |
------------------------------------
|    My page body                     |
|                                               |
|    -----------------------------    |  
|    |  Iframe web site menu |    |
|    -----------------------------     |          
|    |  Iframe website body  |     |
|    |                                     |     |
|    |__________________ |     |
|                                               |
_________________________

What I want it to look like is
-------------------------------------
|              my menu                   |
------------------------------------
|    My page body                     |
|                                               |
|    -----------------------------     |
|    |  Iframe website body  |     |
|    |                                     |     |
|    |__________________ |     |
|                                               |
_________________________

So when a use is presented with my page, in the start of the iframe window, it 'jumps' down past the menu and starts 200px below the top..

0
 
BadotzCommented:
If you don't have control of the HTML in the iframe, I don't see how you can do much of anything.
0
 
JimmyJack123Author Commented:
Oh wait, the <iframe src="http://yourlinkhere.html#body" /> worked like a treat once I worked out that it was case sensitive.

god bless firebug.

Thanks for ya help!
0
 
abelCommented:
you're welcome. Sorry, missed the followup, but glad you found it!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now