Load new items when user scroll to bottom of page。
What you should do is only add a infinite-scroll class to div.content
Note:
div class="page-content infinite-scroll" - the container of infinite scrolldata-distance - distance to bottom to trigger infinite scroll , default is 50 (px)javacript:
{% highlight js %} var loading = false; var maxItems = 100; var itemsPerLoad = 20; function addItems(number, lastIndex) { var html = ''; for (var i = lastIndex + 1; i <= lastIndex + number; i++) { html += 'If you want load items when scroll top of page,you should add infinite-scroll-top class to page-content.
| Event | Target | Description |
|---|---|---|
| infinite |
div.content.infinite-scroll
|
Trigger when user scroll to bottom of page. use data-distance to set distance. |
Two methods can use:
{% highlight js %} $.attachInfiniteScroll(container) - attach infinite scroll listener on container parameters - HTML Element or CSS Selector. {% endhighlight %} {% highlight js %} $.detachInfiniteScroll(container) - remove infinite scroll event parameters - HTML Element or CSS Selector. {% endhighlight %}You need to use $.attachInfiniteScroll only after you have called $.detachInfiniteScroll. The $.detachInfiniteScroll method will auto be called when infinite scroll component init.