Scroll to the top

Using just javascript and no animation:
window.scrollTo(x-coord, y-coord);
that will be window.scrollTo(0,0);

Using jQuery with animation:
$(“html, body").animate({ scrollTop: 0 }, “slow");

Cross reference with scroll to elemenet post.

Just a reference for myself.

廣告