backtop

1.0.1 • Public • Published

BackTop Web Component

This is a web component,back to top or home page.

Usage

  1. download this project dist files.

  2. copy dest folder to your project.

  3. 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>
  1. 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

License

CC-BY-SA

CC-BY-SA 4.0 © SeayXu

Readme

Keywords

Package Sidebar

Install

npm i backtop

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • seay