0.0.3 • Published 4 years ago

backtop.js v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

backtop.js

Chinese Document

Use Javascript to return to the top of the page or scroll to the specified HTML element

# npm
npm i backtop.js --save
import backtop from 'backtop.js';

document.querySelector('#button').addEventListener('click', () => {
  backtop({
    type: 'smooth',
    element: document.querySelector('#title'); // 不传 HTML 节点时默认返回网页顶部
  });
});
  • type?: 'smooth' | 'instant' default smooth
  • element?: HTMLElement
  • speed?: number
  • onStart?: () => {}
  • onBack?: () => {}
  • onEnd?: () => {}
0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago