var doc = document,win = window;var $ScrollBotto;
if($(win).scrollTop() > 0)
$ScrollBottom = $(doc).height() - $(win).height() + $(win).scrollTop();
else
$ScrollBottom = $(doc).height() - $(win).height() - $(win).scrollTop();
回到底部 $('html, body').animate({'scrollTop':$ScrollBottom})
回到顶部 $('html, body').animate({'scrollTop':0})