Jump to content

Prevent Parent From 'jumping' When Iframe Loads A Anchor


DarkxPunk

Recommended Posts

Hey everyone, From what I can gather from my searches this can only be solved by JavaScript. So here is the page: http://www.beta.zeitgeist-toronto.com/faq.php Now as you will see as of (Jan 12th 2012) when you load the page it jumps down to the iFrame anchor. Can I prevent it from jumping or have it jump back to the top of the parent page? Thanks for any help!Michael

Link to comment
Share on other sites

Yes this is quite obvious by my question was "Prevent Parent From 'jumping' When Iframe Loads A Anchor" note: When iFrame Loads a Anchor the #template being that anchor. The whole goal is that when it loads the iframe and jumps the content of the iframe to that section of the page, the actually parent stays at the top, or at least jumps back to the top.

Link to comment
Share on other sites

Safari and IE9, I tested it in FF and noticed it does not move the parent and, but I did not test it in chrome. So I guess this is a Safari, IE9 problem, any suggestions for a fix?

Link to comment
Share on other sites

I don't know if you've noticed, but in Firefox your iframe is very tiny. This problem looks like a result of how the browser handles links. I don't think it can be solved.

Link to comment
Share on other sites

How about this. I am not good with JavaScript so if someone could make it up or assist me. Is it possible to make a script where after the iFrame loads the focus of the page is redirected to the top. That will stop the problem in ie and safari and not hinder ff or chrome.

Link to comment
Share on other sites

this seems to fix IE but not Safari, give iframe id ref myframe

window.onload=function(){var F = document.getElementById("myframe");var Fcontent = F.contentDocument || F.contentWindow.document;Fcontent.location.href= Fcontent.location.href+"#template";window.scrollTo(0,0);}

Link to comment
Share on other sites

OK! something strange is happening here, revert back to original code IF changed, and remove everything except window.scrollTo(0,0);

 window.onload=function(){window.scrollTo(0,0);}

Seems to work fine with just this now! in all browsers, where as before, i had to wait until frame and page loaded, before moving frame content and scrolling to top.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...