Use Journals for your notes and blogging!

Software Development

A journal for sharing all things software development related


Scrolling to the top of a page with JavaScript

Wed, 18 Dec 2019 18:02 UTC by garethbrown

If you are finding that the below does not work ...

window.scrollTo(0, 0);

Change to the more reliable:

document.body.scrollTop = document.documentElement.scrollTop = 0;

The information on this site is provided “AS IS” and without warranties of any kind either express or implied. To the fullest extent permissible pursuant to applicable laws, the author disclaims all warranties, express or implied, including, but not limited to, implied warranties of merchantability, non-infringement and suitability for a particular purpose.


Software development notes and articles

Email garethbrown: mail@appsoftware.com

UI block loader
One moment please ...