1.1.0 • Published 9 years ago
infiniscroll v1.1.0
Infinite Scroll Widget
Create/decorate an element which loads more content automatically when the scroll position reaches either the top or bottom.
var infiniscroll = require('infiniscroll')
var el = infiniscroll('div', {
fetchTop: function (cb) {
el.insertBefore(renderMoreTop(), el.firstChild)
cb()
},
fetchBottom: function (cb) {
el.appendChild(renderMoreBottom())
cb()
}
})
Notes:
fetchTop
andfetchBottom
are optional- the first param may be a tagname, hyperscript template string, or existing DOM element
- When the element scrolls away from the top, this adds a
scrolled
class to do custom styling
LICENSE
MIT