1.0.0 • Published 5 years ago

mil-intersection-observer v1.0.0

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

\<mil-intersection-observer>

'mil-intersection-observer' is an implementation of intersection-observer for Webcomponents. It is compatible with litElement.

Usage

Install from npm

npm install --save mil-intersection-observer

Import to your element

import "mil-intersection-observer";

Use in your element

<mil-intersection-observer @intersect="${this.isIntersecting}" .thresholds="${[0.00, 0.50, 1.00]}" .root-margin="${"30px"}">

<your-element-to-observe></your-element-to-observe>

</mil-intersection-observer>

Attributes

AttributeTypeDefault
thresholdsArray0.0, 0.25, 0.5, 0.75, 1.0
root-marginString0px

Events

@intersect returns an object with 2 properties: detail.isIntersecting: returns true if element is intersecting one of the thresholds. detail.intersectionRatio: returns a value that represents the % of your element intersectiong.