I’m successfully changed the hash value for the location of an IFRAME (as a part of externalizing navigation through Google Document Viewer), however I can’t figure out how to stop the parent jumping down to the top of the IFRAME when the function is triggered.
Does anyone have a JS/jQuery solution? I’ve found this Q&A (also below), but the solution seems dirty and prone to be problematic. Thoughts?
var yScroll=document.body.scrollTop;
window.location.hash = id;
document.body.scrollTop=yScroll;
Also, for reference, the function I’m using is this:
function st_go_to_pg( pg ){
if( pg >= 0) jQuery('.gde-frame').first()[0].contentWindow.location.hash=':0.page.'+pg;
}
Since it looks like no one has a better solution that what I included in the initial question, I suppose I’ll just post that as the answer.
The resulting function to change pages within the document embedded while not changing the y scroll location of the parent page is as follows: