代码如下
$("a").on('click',function(){ $("body,html").animate({scrollTop:0},2000); // 阻止默认事件 return false; })