下载ScrollUp https://github.com/markgoodyear/scrollup
在网页中引用jquery.scrollUp.js、jquery.easing.js、jquery.min.js三个JavaScript脚本,注意顺序
<script src="jquery.min.js"></script> <script src="jquery.easing.js"></script> <script src="jquery.scrollUp.js"></script> 然后加入控制代码
<script> $(function () { $.scrollUp(); }); </script> 以上是最简单的使用方法,还有一种带参数的方法
$(function () { $.scrollUp({ scrollName: 'scrollUp', // Element ID scrollDistance: 300, // Distance from top/bottom before showing element (px) scrollFrom: 'top', // 'top' or 'bottom' scrollSpeed: 300, // Speed back to top (ms) easingType: 'linear', // Scroll to top easing (see http://easings.