...

View Full Version : Iframe moved up hiding JScript Menu when I click on internal hyperlink to anchor



DougMck
05-24-2005, 05:32 AM
Hi,

I am developing a JScript menu for the intranet here at work, it works fine but I have encountered an issue to to with the iframe the content is displayed in when page the iframe is displaying has hyperlinks to anchors further down in the document (its an FAQ page).

What happens is that that when I click on one of the links at the top of the page and it is scrolled down to that place in the document where that topic starts, Internet Explorer is moving the entire iframe up meaning that the content on the parent page above the iframe (which is where the jscript menu sits) is no longer visible, and a space of about an inch / 2.5 cm appears along the bottom of the screen.

I have the overflow set to hidden in the body tag of the parent web page that contains the menu and the iframe so that the menu cannot normally be scrolled off the screen by the user (an this works fine), but that is not stopping IE doing this when a user clicks on the one of the FAQ links.

Anyone out there had a similar problem? or have any suggestions on how to fix this?

Thanks,
:confused:
Doug.

Mr J
05-24-2005, 02:15 PM
Yep, come across the very same problem myself and the only solution I could come up with at the time was to run a function to correct it.

This does mean having to call the function from each link in the iframe.

The function can be put in the parent page then called from the document in the iframe with

onclick="parent.reset_pos()

function reset_pos(){
n=document.body.scrollTop
setTimeout("document.body.scrollTop=n",5)
}

I also found that a slight delay works best.

Someone else may have a better solution though.

DougMck
05-24-2005, 09:59 PM
Thanks, it works perfectly.

Cheers!
:)
Doug.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum