0

I am using this code to get my page to go back to the top of the page upon refresh. However, I want it to SLIDE to the top with the same smoothness that my accordion does. Check it out in FF - Don't try this in IE9, there is a bug there I haven't figured out yet (unless you just feel like fixing that for me!).

$(document).ready(function(){
$('html').animate({scrollTop:0}, 1);
$('body').animate({scrollTop:0}, 1);
});

You can see it here: http://imip.rvadv.com/index3.html

On a more philosophical note: Is this a stupid idea? Should I really care about this?

imakeitpretty
  • 2,108
  • 5
  • 16
  • 16

1 Answers1

1

The second parameter on the animate() method is in milliseconds. Change it to 1000 and it should be fine.

$(document).ready(function(){
  $('body, html').animate({scrollTop:0}, 1000);
});

This might give you some cross-browser issues though, specifically in Opera, as discussed here.

Community
  • 1
  • 1
market
  • 473
  • 1
  • 4
  • 9