1.0.0 • Published 7 years ago
brisky-scroll v1.0.0
brisky-scroll
Scroll property that stores and applies scroll using state
usage
// elem
{
props: {
scrollTop: {
$: 'funkyScrollField'
}
}
}
will do internally
// elem
{
props: {
scrollTop: {
$: 'funkyScrollField',
render: {
state () {
const t = target // find the node
t.scrollTop = val * (t.scrollWidth - t.offsetWidth) // expects proportion
},
static () {
t.scrollTop = val // expects exact value
}
}
}
},
on: {
scroll: {
briskyScroll (e, stamp) { // update the state on scroll using proportion
const t = e.target
e.state.get('funkyScrollField', 0).set({
scroll: t.scrollTop / (t.scrollWidth - t.offsetWidth)
}, stamp)
}
}
}
}
1.0.0
7 years ago