作者QQ:1095737364 QQ群:123300273 欢迎加入!
1.css样式 :
<style> #topBtn { position: fixed; bottom: 380px; right: 50px; width: 60px; height: 60px; line-height: 60px; text-align: center; color: #FFF; z-index: 999; background: #FF5722; cursor: pointer; border-radius: 30px; box-shadow: 0px 0px 20px #000; } </style>
2.js代码:
<script type="text/javascript"> $(function () { $("#topBtn").click(function () { $("html,body").animate({scrollTop: $("body").offset().top}, 600); }); }); </script>
3.html 代码:
<div id="topBtn">置顶</div>