selectors-observer

1.0.0 • Public • Published

selectors-observer

可以快速获取用户正在阅读内容的锚点的工具库,框架通用

install

yarn add selectors-observer

or

npm install selectors-observer

demo

import SelectorsObserver from 'selectors-observer';

const selectors = ['#anchor1', '#anchor2', '#anchor3'];

const oberver = new SelectorsObserver();

oberver.select(selectors).listen((selecor) => {
  // 每次正在浏览的锚点变更时,会触发listen
  setViewing(selecor);
});

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.00latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.00

Package Sidebar

Install

npm i selectors-observer

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

5.28 kB

Total Files

4

Last publish

Collaborators

  • yrobot