Skip to content

Repository files navigation

More

Build StatusCoverage Status

Append more div the list element, check loading on scroll.

demo

Installation

Install with npm:

$ npm install more-mobile

Install with component(1):

$ component install chemzqm/more

Events

  • load is emitted after callback called.

API

varmore=require('more')varel=document.querySelector('ul')vartimes=0more(el,function(){returnnewPromise(function(resolve,reject){vararr// fetch the listif(err)returnreject()if(arr.length){more.disable()//disable loading}resolve()})})})

new More(el, callback, [scrollable])

Insert more after list el, call the callback with a function when more div could be visible(or return promise)

scrollable is Object (could be element or other object) which emit scroll event, it default to el.parentNode, could also be window

.disable()

Disable more loading.

.remove()

Remove inserted div and unbind events

.load()

Force more start loading data without scroll event fired (will not load if it's loading or disabled)

Return promise

License

MIT

About

load more data when bottom is shown

Resources

Stars

6 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages