Scrolling main document after iframe has finished loading
Hi all, I've got a tricky problem
I have a long (more that one screen) document, which has a iframe in the bottom. The iframe target URL contains a "bookmark" (hash mark) to scroll the iframe contents, like this:
- <iframe src="document.html#bookmark"></iframe>
The problem with this is that the main document also scrolls down to show the bookmark in the iframe!
So I tried to solve this with a little jQuery in the main document, but I can't get it to work as it should:
- $('iframe').ready(function () {
- //alert('hello world');
- $(document).scrollTop(0);
- });
The alert show that the function is triggered (and having it enabled, actually prevents the document from scrolling down), but the scrollTop() is not executed...