Small, fast, no-dependency, scroll intersection implementation.
A scroll intersection observer for a use case where IntersectionObserver doesn't work/make sense.
Creates an instance of scroll intersection interest between a moving element and a target Rect. Returns the instance API.
Option Name | Data Type | Description |
---|---|---|
scrollSelector |
String | Unique selector of the element that is the source of the scroll event. |
movingSelector |
String | Unique selector of the moving element that intersects with a target Rect. |
target |
String or Function | Selector of the element to test intersection with or a function that returns an arbitrary Rect to test intersection with. |
notify |
Function | Called on intersection or dis-intersection, receives an Object containing two props: intersection {Boolean} and from {Object}. intersection is true if intersecting, false otherwise. If intersection is true, from contains Booleans indicating side of intersection: top , bottom , left , and right . |
Starts scroll event listening.
Stops scroll event listening.
Returns the instance bound updateScroll worker method. Useful primarily for component composition.