This is a web component,back to top or home page.
-
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>
<!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>
-
scroll type,default is 0.
0:uniform speed.
1:uniform acceleration speed.
2:uniform deceleration speed.
-
scroll times,default is 500ms.
Icons : Linearicons Free v1.0.0