請點擊本頁面的 跳到底部 鏈接體驗效果
或者前往體驗效果:http://hovertree.com/texiao/jquery/9.htm
以下是實現代碼:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>跳到底部 jquery效果- 何問起</title>
<meta charset="utf-8" />
<style>
a{color:white}body{margin:0px}
</style>
<script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-1.11.3.min.js"></script>
</head>
<body>
<div style="position:fixed;left:0px;right:0px;width:120px;margin-left:auto;margin-right:auto;top:130px;background-color:silver">
<a id="hovertreetofoot" style="color:red" href="javascript:;">跳到底部</a> <a href="http://hovertree.com/hvtart/bjae/65358656.htm">效果</a>
</div>
<div style="background-color:#959822; width:100%;height:150px;">請點擊本頁面的 跳到底部 鏈接體驗效果</div>
<div style="background-color:Green; width:100%;height:150px;">
hovertree.com
<br /><a href="http:///dev/94fb5964c80ee829.htm" target="_blank">綠色箭頭圖片返回頂部效果</a>
<br /><a href="http:///a/bjac/7cc2358ac924ebc5.htm" target="_blank">藍色方塊返回頂部</a>
<br /><a href="http:///a/bjac/6f008786225269ac.htm" target="_blank">純文本返回頂部</a>
<br /><a href="http:///a/bjac/8aa32432160f9aa4.htm" target="_blank">漂亮的返回頂部、底部和留言</a>
</div>
<div style="width:738px;height:186px;margin:10px auto;">
</div>
<div style="background-color:Red; width:100%;height:150px;">歡迎</div>
<div style="background-color:Yellow; width:100%;height:150px;"><a href="http://hovertree.com/">首頁</a></div>
<div style="background-color:Silver; width:100%;height:150px;">何問起</div>
<div style="background-color:Aqua; width:100%;height:150px;">hovertree.com</div>
<div style="background-color:Fuchsia; width:100%;height:150px;"><a href="http://hovertree.com/texiao/">更多特效</a></div>
<div style="background-color:Green; width:100%;height:150px;">hovertreetofoot</div>
<div style="background-color:Blue; width:100%;height:150px;"></div>
<div style="background-color:Olive; width:100%;height:350px;">何問起 返回頂部</div>
<div style="background-color:Green; width:100%;height:150px;">HoverTree</div>
<div style="background-color:Purple; width:100%;height:150px;">jquery</div>
<div style="background-color:Green; width:100%;height:150px;"><a href="http://hovertree.com/hvtart/bjae/65358656.htm" target="_blank">原文</a></div>
<div style="background-color:Lime; width:100%;height:150px;">hovertree.com</div>
<div style="background-color:Orange; width:100%;height:150px;">完整代碼</div>
<div style="height:130px;"></div>
<script>
$('#hovert'+'reetofoot').click(function () {
$('html,body').animate({ scrollTop: $(document).height() }, 1000); return false;
});</script>
</body>
</html>
跳到底部 效果 by 何問起