I have an iFrame that when loaded stretches his whole length without scrollbars.
After 1 second I want to scroll to an anchor in the iFrame.
I think I need to get it's height?
How can I do this?
HTML:
<iframe id="help-frame" src="help.php" scrolling="no"><\/iframe>
JS:
$("#help-frame").load(function() {
document.getElementById("help-frame").style.height =
document.getElementById("help-frame").contentWindow.document.body.offsetHeight + 'px';
setTimeout(iScroll, 1000);
});
function iScroll() {
var anchorH = $("#help-frame").contents().find("a.ordering").height();
alert(anchorH);
// smooth scroll to #ordering
}
HTML help.php:
<!-- added a class as well -->
<a name="ordering" class="ordering"></a>
<h2>Ordering</h2>
... long content ...