1.html
<div id='returnTool'>返回頂部</div>
2.css (將returnTool層至於頁面底部固定不動)
<style type="text/css">
#returnTool {
position:absolute;
margin-bottom:0px;
width:95%;
height:100px;
text-align:right;
z-index:2;
overflow:hidden;
cursor: pointer;
}
</style>
3.js
<script type="text/javascript">
$("#returnTool").click(function () {
$("html,body").animate({scrollTop:"0px"},50);//50毫秒完成回到頂部動畫
})
</script>