@@ -63,6 +63,14 @@ Triggered when the user has hit the scroll threshold for the next page due to sc
63
63
| :--- | :--- | :--- |
64
64
| distance | int | The distance to the scroll threshold in pixels |
65
65
66
+ ### top
67
+
68
+ Triggered when the user has hit the top of the scroll area for the previous page due to scrolling or resizing.
69
+
70
+ | property | type | description |
71
+ | :--- | :--- | :---------------------------------------|
72
+ | distance | int | The distance to the scroll top in pixels |
73
+
66
74
### next
67
75
68
76
Triggered right after the ` hit ` event. Indicating that the next page will be loaded.
@@ -93,6 +101,36 @@ Trigger when loading and appending the next page is completed.
93
101
| :--- | :--- | :--- |
94
102
| pageIndex | int | The page index of the next page (the page that is finished loading) |
95
103
104
+ ### prev
105
+
106
+ Triggered right after the ` top ` event. Indicating that the previous page will be loaded.
107
+
108
+ | property | type | description |
109
+ | :--- | :--- | :--- |
110
+ | pageIndex | int | The page index of the next page (the page that is about to be loaded) |
111
+
112
+ > pageIndex is zero indexed. This means the index starts at 0 on the first page.
113
+
114
+ For example to notify the user about loading the next page, you can do:
115
+
116
+ ``` js
117
+ ias .on (' prev' , function (event ) {
118
+ // pageIndex is 0-indexed, so we add 1
119
+ alert (` Page ${ event .pageIndex + 1 } is loading...` );
120
+ });
121
+ ias .on (' preved' , function (event ) {
122
+ alert (` Page ${ event .pageIndex + 1 } is loaded and prepended to the page.` );
123
+ });
124
+ ```
125
+
126
+ ### preved
127
+
128
+ Trigger when loading and prepending the previous page is completed.
129
+
130
+ | property | type | description |
131
+ | :--- | :--- | :--- |
132
+ | pageIndex | int | The page index of the next page (the page that is finished loading) |
133
+
96
134
### load
97
135
98
136
This event is triggered before the next page is requested from the server.
@@ -158,18 +196,49 @@ This event is triggered after the items have been appended.
158
196
| items | array | Array of items that have been appended |
159
197
| parent | Element | The element to which the items have been appended |
160
198
199
+ ### prepend
200
+
201
+ This event is triggered before the items are about to be prepended.
202
+
203
+ | property | type | description |
204
+ | :--- | :--- | :-------------------------------------------------|
205
+ | items | array | Array of items that will be prepended |
206
+ | parent | Element | The element to which the items will be prepended |
207
+ | prependFn | function | Function used to append items to the container |
208
+
209
+ See [ src/append.js] ( ../src/append.js ) for the default append function.
210
+
211
+ ### prepended
212
+
213
+ This event is triggered after the items have been prepended.
214
+
215
+ | property | type | description |
216
+ | :--- | :--- | :---------------------------------------------------|
217
+ | items | array | Array of items that have been prepended |
218
+ | parent | Element | The element to which the items have been prepended |
219
+
161
220
### last
162
221
163
222
Triggered when the last page is appended.
164
223
165
224
``` javascript
166
225
ias .on (' last' , () => {
167
- console .log (' Users has reached the last page' );
226
+ console .log (' User has reached the last page' );
168
227
})
169
228
```
170
229
171
230
[ Read more on how we can inform the user about reaching the last page] ( advanced/last-page-message.md )
172
231
232
+ ### first
233
+
234
+ Triggered when the last page is appended.
235
+
236
+ ``` javascript
237
+ ias .on (' first' , () => {
238
+ console .log (' User has reached the first page' );
239
+ })
240
+ ```
241
+
173
242
### page
174
243
175
244
Triggered when the user scrolls past a page break. The event provides information about the page in view.
0 commit comments