//置顶
document.getElementById("pro-view-8").onclick = function(){document.body.scrollIntoView();}
window.onscroll = function(){
if(document.body.scrollTop > 30){
if($("#pro-view-8")[0].style.display === "block") {return;}
$("#pro-view-8").show();
}else{
if($("#pro-view-8")[0].style.display === "none") {return;}
$("#pro-view-8").hide();
}
}
方式2
function scrollToLocation(id){
document.body.scrollTop = $("#"+id).offset().top;
}
<div class="content" id="top"></div>