Jquery - 滚动到顶部

Rya*_*tle 0 html css jquery

所以,我有一个工作的jquery脚本,当单击一个按钮时,页面会滚动到底部.我的目标是再次执行此操作,但我希望它滚动到页面顶部而不是滚动到底部.这是我的代码;

function scrolldown() { //Scroll to bottom
$("html, body").animate({ scrollTop: $(document).height() }, 1250);
};

function scrollup(){ //Scroll to top
$("html, body").animate({ scrollTop: $(document).top() }, 1250);
};
Run Code Online (Sandbox Code Playgroud)

请帮我弄清楚我需要做什么,以便我的脚本按照我的意愿行事.谢谢!

Moo*_*man 5

$("html, body").animate({scrollTop: 0}, 1250);
Run Code Online (Sandbox Code Playgroud)

小提琴:http://jsfiddle.net/4H4VY/