一种简单的实现,是通过jquery的scrollTo(0, 0);。
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
-
<html lang="en">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
-
<script type="text/javascript" src="test/js/jquery-1.11.1.min.js"></script>
-
<title></title>
-
</head>
-
<body>
-
<div>
-
<div style="height:1000px;">初始化</div>
-
<div style="height:1000px">
-
<div
-
style="position:fixed;right:10px;bottom:50px;width:20px;height:70px;background-color:red;cursor:hand;"
-
onclick="scrollTo(0, 0)">返回顶端</div>
-
</div>
-
</body>
-
</html>
阅读(774) | 评论(0) | 转发(0) |