Constructor
new StuckObserver(optionsopt) → {StuckObserver}
Parameters
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
<optional> |
{} |
Configuration options
|
Returns
StuckObserver
- StuckObserver instance
Example
const observer = new StuckObserver(options={})
const el = createElement({style: {position: 'sticky', top: 0}})
observer.observe(el)
Methods
observe(el, callbackopt)
Extends IntersectionObserver.observe to add a callback option that is called every time stuck status is changed
Parameters
Name | Type | Attributes | Description |
---|---|---|---|
el |
HTMLElement
|
Element to observe |
|
callback |
function
|
<optional> |
Callback function that receives stuck status (true|false) as argument |