0.0.5 • Published 5 years ago

op-view-progress v0.0.5

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

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, where 0 is for elements in the middle
  • 1 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;