Every time I browse to my website, it shows up scrolled a bit down. When I visit different parts of the site, the pages load also scrolled a ways down. What causes this? Is it possible to make all pages load at the very top (at the site header)?
Thanks.
-
☆ A M B ☆
- 24,524 Posts
Do you by any chance have a form somewhere in the page? If so, are any of the form fields given a focus? If they do, the page will auto-scroll to focus on that form field.
-
☆ A M B ☆
- 24,524 Posts
Yes, you do. You have the login form in the sidebar. The login form specifies that the first field gets the focus. So depending on screen size and resolution, if that form field falls below the bottom of the screen, the page will scroll down to expose the form field. You’ll notice the blinking cursor is already in that field.
At the bottom of the page:
<script type="text/javascript">
if (document.loginfrm) document.loginfrm.username.focus();
</script>
-
☆ A M B ☆
- 24,524 Posts
No, it won’t hurt anything. All it does is force the focus to the username field, which is what’s causing the page to scroll.