@codin/cwc-intersection
TypeScript icon, indicating that this package has built-in type declarations

0.3.8 • Public • Published

npm version

Intersection Element

Element for detecting intersection.

properties

disabled?: bool: false, reflect: true

When disabled the intersection adapter is removed

once?: bool: false

If true, the element wil await first intersection, then set it self as diabled.

margin?: string

Intersection offset, just like normal css margins.

threshold?: string|float[]

Decimal or CSV decimals .1,.5,.9 when used from html. flaot array when set by JS

Events

  • intersection triggerd when intersection
  • intersect-in triggerd when intersecting
  • intersect-out triggerd when not intersecting

Example

<style>
 cwc-intersection {
  border: 1px solid black;
  opacity: .5;
 }
 cwc-intersection[intersected] {
  border-color: red;
 }
 cwc-intersection[intersecting] {
  opacity: 1;
 }
</style>
<cwc-intersection treshold="1">
 <span>Foo Bar</span>
</cwc-intersection>

/@codin/cwc-intersection/

    Package Sidebar

    Install

    npm i @codin/cwc-intersection

    Weekly Downloads

    7

    Version

    0.3.8

    License

    MIT

    Unpacked Size

    47 kB

    Total Files

    16

    Last publish

    Collaborators

    • _odin_