Reputation: 27
Chrome maintains the scrollTop
from previous page.
Eg: I am in list page and scroll down to end of the page and clicked on a record to view. The view record opened in a new page but the scroll position is not on the top.
Tried and failed:
1)In document.ready()
made the scrollTop as 0
(View page)
2)On window onunload()
made scrollTop as 0
(in list page)
Upvotes: 0
Views: 60
Reputation: 6180
Add this code to the page you are going to:
<script type="text/javascript">
window.scrollTo(0,0);
</script>
Upvotes: 1
Reputation: 459
Use below Window event and write page-top over there.
window.onpageshow = function(event) {
if (event.persisted) {
//Scroll top code will go here.
}
Upvotes: 0