Skip to content

Commit 9d9d851

Browse files
committed
Merge remote-tracking branch 'origin/master' into scope-fixes
* origin/master: (40 commits) updated dependencies Bump rollup from 1.27.8 to 1.27.9 Bump rollup from 1.27.7 to 1.27.8 Bump eslint from 6.7.1 to 6.7.2 Bump rollup from 1.27.5 to 1.27.7 Bump cypress from 3.6.1 to 3.7.0 Bump http-server from 0.11.1 to 0.12.0 Bump rollup from 1.27.4 to 1.27.5 Bump eslint from 6.6.0 to 6.7.1 Bump rollup from 1.27.3 to 1.27.4 Bump rollup from 1.27.2 to 1.27.3 Bump rollup from 1.27.0 to 1.27.2 Bump rollup from 1.26.3 to 1.27.0 Bump cypress from 3.6.0 to 3.6.1 Bump rollup from 1.26.2 to 1.26.3 Bump cypress from 3.5.0 to 3.6.0 Bump rollup from 1.26.0 to 1.26.2 Bump rollup from 1.25.2 to 1.26.0 Bump eslint from 6.5.1 to 6.6.0 attempt to remove introduction page from gitbook ...
2 parents 45b15e6 + 052ae25 commit 9d9d851

File tree

18 files changed

+557
-251
lines changed

18 files changed

+557
-251
lines changed

.gitbook.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
root: ./docs/
22

33
structure:
4-
readme: README.md
4+
readme: overview.md
55
summary: README.md
6+
7+
redirects:
8+
options: ./options.md
9+
methods: ./methods.md
10+
events: ./events.md

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Please consider the following:
2525
2626
1. Can you make a simplified version that reproduces the issue? For example, can you reproduce using one of the available Codesandboxes (see https://codesandbox.io/s/github/webcreate/infinite-ajax-scroll/tree/master/examples/articles)?
2727
2. If that's not possible, can you provide a live version of your work so we can have a look and inspect your code and configuration?
28+
3. Can you provide code examples, preferably your html and javascript code.
2829
-->
2930

3031
**Expected behavior**
@@ -34,5 +35,5 @@ Please consider the following:
3435
<!-- Please describe your environment -->
3536

3637
- Infinite Ajax Scroll version:
37-
- Browser version:
38+
- Browser + version:
3839
- Operating System:

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ install:
1010
cd examples/masonry && npm install && npm link && npm run build;
1111
.PHONY: install
1212

13+
update:
14+
cd examples/articles && npm update;
15+
cd examples/blocks && npm update;
16+
cd examples/masonry && npm update;
17+
.PHONY: update
18+
1319
up:
1420
npm run start
1521
open http://localhost:8080

docs/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
# Table of contents
22

3+
* [Overview](overview.md)
34
* [Installation](installation.md)
45
* [Getting started](getting-started.md)
6+
* [License](license.md)
7+
* [Support](support.md)
8+
9+
## Reference
10+
511
* [Options](options.md)
612
* [Methods](methods.md)
713
* [Events](events.md)
814

15+
## Advanced
16+
17+
* [Triggers](advanced/triggers.md)
18+
* [Last page message](advanced/last-page-message.md)
19+
* [History](advanced/history.md)
20+
* [Overflow](advanced/overflow.md)

docs/advanced/history.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# History
2+
3+
## Updating url and title
4+
5+
When users are scrolling through pages we can update the browser url and page title. This allows the current page to be shared or bookmarked.
6+
7+
We can achieve this by listening for the [`page`](events.md#page) event. The page event contains the `url` and `title` of the current page in view.
8+
9+
The [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) can be used to update the url.
10+
11+
```javascript
12+
ias.on('page', (event) => {
13+
// update the title
14+
document.title = event.title;
15+
16+
// update the url
17+
let state = history.state;
18+
history.replaceState(state, event.title, event.url);
19+
});
20+
```
21+
22+
[View this behaviour in a live demo](https://v3.infiniteajaxscroll.com/examples/articles/)
23+
24+
## Loading previous pages
25+
26+
{% hint style='working' %}
27+
This feature is still work in progress
28+
{% endhint %}

docs/advanced/last-page-message.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Last page message
2+
3+
When your pages are finite, it is best practise to inform the user that the last page was hit.
4+
5+
First add an element to your document with the message you want to show.
6+
7+
```html
8+
<div class="no-more">No more pages</div>
9+
```
10+
11+
Next add a bit of CSS to hide the element on default:
12+
13+
```css
14+
.no-more {
15+
opacity: 0;
16+
}
17+
```
18+
19+
Then listen for the [`last`](../events.md#last) event and show to element.
20+
21+
```javascript
22+
let ias = new InfiniteAjaxScroll(/* config */);
23+
24+
ias.on('last', function() {
25+
let el = document.querySelector('.no-more');
26+
27+
el.style.opacity = '1';
28+
})
29+
```
30+
31+
[View this behaviour in a live demo](https://v3.infiniteajaxscroll.com/examples/articles/)

docs/advanced/overflow.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Overflow
2+
3+
{% hint style='working' %}
4+
This feature is still work in progress
5+
{% endhint %}
6+
7+
It is possible to have infinite scrolling pages inside an overflow element.
8+
9+
First define a container element.
10+
11+
```html
12+
<div id="scroller">
13+
<div class="item">Item 1</div>
14+
<div class="item">Item 2</div>
15+
<!-- more items -->
16+
</div>
17+
```
18+
19+
Then configure the overflow using css. Don't forget to give the element a fixed height.
20+
21+
```css
22+
#scroller {
23+
overflow: scroll;
24+
height: 200px;
25+
}
26+
```
27+
28+
Then configure the element as scroll container.
29+
30+
```javascript
31+
let ias = new InfiniteAjaxScroll('#scroller', {
32+
scrollContainer: '#scroller'
33+
});
34+
```

docs/advanced/triggers.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Triggers
2+
3+
{% hint style='working' %}
4+
This feature is still work in progress
5+
{% endhint %}
6+
7+
Instead of loading next pages on scroll you can use a trigger. A trigger is a link or button that has to be clicked before the next page is loaded.
8+
9+
Reasons for a trigger might be:
10+
11+
* To make the footer reachable.
12+
* To ease the load on the server. Users have to click before loading the next page. This adds a natural delay.
13+

docs/events.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ This event is triggered after the items have been appended.
113113

114114
Triggered when the last page is appended.
115115

116+
```javascript
117+
ias.on('last', () => {
118+
console.log('Users has reached the last page');
119+
})
120+
```
121+
122+
[Read more on how we can inform the user about reaching the last page](advanced/last-page-message.md)
123+
116124
### page
117125

118126
Triggered when the user scrolls past a page break. The event provides information about the page in view.
@@ -124,5 +132,19 @@ Triggered when the user scrolls past a page break. The event provides informatio
124132
| title | string | Title of the page |
125133
| sentinel | Element | Sentinel element. Element used to determine on which page the user is |
126134

127-
> pageIndex is zero indexed. This means the index starts at 0 on the first page.
135+
> pageIndex is zero-based. This means the index starts at 0 on the first page.
136+
137+
One use case for this event is to update the browser url and title:
138+
139+
```javascript
140+
ias.on('page', (event) => {
141+
// update the title
142+
document.title = event.title;
143+
144+
// update the url
145+
let state = history.state;
146+
history.replaceState(state, event.title, event.url);
147+
})
148+
```
128149

150+
[View this behaviour in a live demo](https://v3.infiniteajaxscroll.com/examples/articles/)

docs/license.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# License
2+
3+
Read about our licensing options.
4+
5+
## Open source license
6+
7+
This license is designed for open-source and non-commercial websites and applications. The Infinite Ajax Scroll open source license is [Affero General Public License (AGPL)](https://www.gnu.org/licenses/agpl-3.0.en.html). The most important part of the license is:
8+
9+
> The key point of the GPL is that it's "sticky." If you use GPL-licensed software in a modified form or incorporate it into your product, you have to make it available under the same terms. You can sell the software, but you also have to make its source code freely available.
10+
11+
> The AGPL is even stickier than the GPL. Its stickiness extends to code which runs on servers, even if it's never published.
12+
13+
<sub>source: https://www.kwork.me/open-source-free-software-licenses/</sub>
14+
15+
## Commercial license
16+
17+
The commercial license is designed to use Infinite Ajax Scroll in closed-source/proprietary websites and applications. This license removes the "sticky" requirements as described above.
18+
19+
After purchase you will receive a Commercial License PDF which grants the right to use Infinite Ajax Scroll in your commercial projects.
20+
21+
[Buy a commercial license](https://infiniteajaxscroll.com/pricing)
22+
23+
## OEM license
24+
25+
If you develop a commercial SDK, plugin, theme, or an other kind of wrapper around Infinite Ajax Scroll we offer an Commercial OEM License. This license is customized and pricing depends on the expected sales volume and pricing. Please contact us at [[email protected]](mailto:[email protected]) for more details.

0 commit comments

Comments
 (0)