op-view-progress
v0.0.5
Published
Element's position on the screen / viewport
Downloads
12
Maintainers
Readme
op-view-progress
Element's position on the screen / view. Progress is calculated in relation between node's top position, height and window's height. The value is:
-1
and less for items under viewport-1 ... 0 ... 1
in the viewport, where0
is for elements in the middle1
and more for items above viewport
Install
npm install op-view-progress
yarn add op-view-progress
Usage
import opViewProgress from 'op-view-progress';
Create instance:
const progress = new opViewProgress(domNode);
Update / tick:
progress.tick();
Get value:
progress.value;