jQuery 回到顶端
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<style>
body{height:2500px;}
.go_top{right:10px;bottom:10px;position:fixed;cursor:pointer;}
</style>
<body>
<input type="button" value="go_top" class="go_top">
</body>
</html>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script>
$(function(){
//回到顶端按钮点击的时候
$('.go_top').click(function(){
//给 body html 绑定动画,设置滚动条距离为0 速度为300毫秒
$('body,html').animate({scrollTop:0}, 300);
})
});
</script>