1.1.0 • Published 9 years ago

infiniscroll v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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 and fetchBottom 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