I have an iFrame with a feedback form in it. After the user clicks submit, I want use parent window to scroll to the top. I know I can scroll to the top of a page with:
$('html, body').animate({scrollTop:0}, 'slow');
However, this will only scroll the contents of the iframe, not the parent page. Any suggestions?
Give a try for this one :
<body onLoad="window.parent.scroll(0,0);">
In the body of the iframe's html page
Its as simple as you can do!
This seems to do the trick as well:
$('html, body', window.parent.document).animate({scrollTop:0}, 'slow');
The second parameter to
$
is the context to search in.Within the Iframe page.
On The parrent page: