@codin/cwc-intersection
v0.3.8
Published
Panel that implements intersection observer, triggers events when intersecting
Downloads
17
Readme
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 intersectionintersect-in
triggerd when intersectingintersect-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>