ui/scrollpoint
Module that uses intersection observer to add scrollpoint like behavior.
ui/scrollpoint.Scrollpoint
Single scrollpoint
- Note "forward" and "reverse" refer to scroll directions
- forward = vertical below / horizontal right
- reverse = vertical above / horizontal left
Kind: static class of ui/scrollpoint
Todo
- [ ] Convert margin to offset
- [ ] This only goes one direction
new exports.Scrollpoint(element, config)
Setup a new scrollpoint
Param | Type | Description |
---|---|---|
element | Node |
The element to create the scrollpoint for |
config | Object |
Options to configure the scrollpoint see Scrollpoint.defaults for more information on settings |
scrollpoint.onObserve()
IntersectionObserver Callback
- Should set the state
Kind: instance method of Scrollpoint
ui/scrollpoint.initializer
Scrollpoint Component Initializer
Kind: static constant of ui/scrollpoint
ui/scrollpoint.init()
Initialize everything in document
- This will only initialize elements once, it is safe to call on page changes
Kind: static method of ui/scrollpoint
ui/scrollpoint~root
Default observer root element
Kind: inner property of ui/scrollpoint
ui/scrollpoint~rootSelector
Use a selector to select the observer root element
Kind: inner property of ui/scrollpoint
ui/scrollpoint~debug
Log debug info to console
Kind: inner property of ui/scrollpoint
ui/scrollpoint~horizontal
Change scroll orientation to horizontal
Kind: inner property of ui/scrollpoint
ui/scrollpoint~marginStart
Margin for observer top or left (depending on orientation)
Kind: inner property of ui/scrollpoint
ui/scrollpoint~marginEnd
Margin for observer bottom or right (depending on orientation)
Kind: inner property of ui/scrollpoint
ui/scrollpoint~threshold
Threshold for observer
Kind: inner property of ui/scrollpoint
ui/scrollpoint~exit
The point can exited (else persists)
Kind: inner property of ui/scrollpoint
ui/scrollpoint~exitForward
The point can exit from the end
Kind: inner property of ui/scrollpoint
ui/scrollpoint~exitReverse
The point can exit from the start
Kind: inner property of ui/scrollpoint
ui/scrollpoint~setClasses
Set state classes
Kind: inner property of ui/scrollpoint
ui/scrollpoint~classPrefix
Prefix for classes
Kind: inner property of ui/scrollpoint
ui/scrollpoint~setAttribute
Set attribute for state (less verbose same info as classes)
Kind: inner property of ui/scrollpoint
ui/scrollpoint~attributeName
Attribute name to set state info in
Kind: inner property of ui/scrollpoint
ui/scrollpoint~syncElements
Elements that should also get active state info (classes or attributes)
Kind: inner property of ui/scrollpoint
ui/scrollpoint~onChange()
Callback called when state changes
Kind: inner method of ui/scrollpoint