...

View Full Version : always start at top on page refresh?



resin
05-30-2012, 05:12 PM
Hello, I came across a page the other day, that would automatically scroll you to the top of the page after refreshing, if you happened to be scrolled down some prior to refreshing. Could anyone explain how I can accomplish this?

chrisf
05-30-2012, 05:14 PM
$(document).ready(function(){
$(this).scrollTop(0);
});



**You will have to link to jQuery to make this work**

resin
05-30-2012, 05:51 PM
It didn't work for me. When I scroll down the page and then refresh, the page stays scrolled down. I just need to place that code within <script></script> inside the header? I have linked to jQuery.

chrisf
05-30-2012, 05:56 PM
It didn't work for me. When I scroll down the page and then refresh, the page stays scrolled down. I just need to place that code within <script></script> inside the header? I have linked to jQuery.

I would recommend putting the script at the end of the page before the closing body tags.

resin
05-31-2012, 09:27 AM
Ok so it look like your code does work for Firefox, but not IE. Is there some additional code to make it work in IE? Here is a great example that works in IE- http://www.talentgarden.it/it/#!/home . Scroll down that page some, and then refresh. It will automatically start you back at the top. This is exactly what I need.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum