backtop
v1.0.1
Published
web back to top component
Downloads
21
Readme
BackTop Web Component
This is a web component,back to top or home page.
Usage
download this project dist files.
copy dest folder to your project.
import .js and .css files to web page.
<link rel="stylesheet" href="./style/linearicons-free.min.css">
<link rel="stylesheet" href="./style/backtop.min.css">
<script type="text/javascript" src="./js/backtop.min.js"></script>
- add javascript code
<script type="text/javascript">
BackTop.init(1,500);
</script>
Sample
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>返回顶部组件示例</title>
<link rel="stylesheet" href="./style/linearicons-free.min.css">
<link rel="stylesheet" href="./style/backtop.min.css">
<style type="text/css">
body{height: 6000px;}
</style>
</head>
<body>
</body>
<script type="text/javascript" src="./js/backtop.min.js"></script>
<script type="text/javascript">
BackTop.init(1,500);
</script>
</html>
API
BackTop.init(type,time);
type
scroll type,default is 0.
0:uniform speed.
1:uniform acceleration speed.
2:uniform deceleration speed.
time
scroll times,default is 500ms.
Other
Icons : Linearicons Free v1.0.0