Start a new topic

How can I disable auto-scrolling to the top on page reload? After

Hi, I have purchased your Fine Shape template and am trying to modify it for my purposes. Everything works great - except when I refresh the page, it automatically scrolls to the top. This is annoying when I want to stay where I was on the page, especially when I try to fill out the contact form at the bottom. Upon submitting the form, the page refreshes and goes to the top, so I have to scroll down to see what the result is. 


This is important because if the user makes a mistake and the contact form alerts him to change something, the user doesn't see it and may assume that the message was sent - unless he scrolls all the way to the bottom again and looks at the result.


I tried using anchors, but they don't work either. I searched the web to find the right fix, but nothing worked.


Can you please tell me how to disable that feature so that the user can stay on the same place on the page after it reloads?


Thank you,

1 Comment

I found the answer - I disabled this Javascript code in the head of the page - 


<!--script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);

  function hideURLbar(){ window.scrollTo(0,1); } </script-->


Its only function was to keep the URL bar clean without showing the hashtags, but it also prevented me from staying on the page where I left off. That function was pretty useless if you ask me, and the downside was far greater than the presumed benefit.

Login or Signup to post a comment