Version 3.1.0 is backwards-compatible with 3.0.x.
Version 3 is a complete overhaul of Infinite Ajax Scroll.
Most important changes:
- Dropped jQuery support
- Dropped extensions architecture
- Switched to NPM package
You can use the CDN version by adding this to the <head>
section:
<script src="https://unpkg.com/@webcreate/infinite-ajax-scroll@3/dist/infinite-ajax-scroll.min.js"></script>
or install from NPM
$ npm install --save @webcreate/infinite-ajax-scroll
and import into your application
import InfiniteAjaxScroll from '@webcreate/infinite-ajax-scroll';
We no longer depend on jQuery.
var ias = jQuery.ias({
container: '#posts',
item: '.post',
pagination: '#pagination',
next: '.next'
});
becomes
// import if you use the NPM package (not needed if you use CDN)
import InfiniteAjaxScroll from '@webcreate/infinite-ajax-scroll';
let ias = new InfiniteAjaxScroll('#posts', {
item: '.post',
next: '.next',
pagination: '#pagination'
});
Most plugins turned into options. For example the Spinner Extension:
// Add a loader image which is displayed during loading
ias.extension(new IASSpinnerExtension());
becomes
let ias = new InfiniteAjaxScroll('#posts', {
//...
spinner: '.spinner',
});
Where .spinner
references a html element by class name. You will have to add this element yourself, e.g.
<div class="spinner">loading...</div>
Use the documentation to learn how to use the new way of using these features:
Other extensions are now build-in as events:
Finally, the History Extension is dropped entirely.
container
option is renamed toscrollContainer
delay
option moved tospinner.delay
optioninitialize
option is renamed tobind
destroy
method is removed -> use unbindextension
method is removedinitialize
method renamed tobind
reinitialize
method is replaced bybind
andunbind
one
method is renamed toonce
scroll
is renamed toscrolled
render
is renamed toappend
rendered
is renamed toappended
noneLeft
is renamed tolast
noneLeft
event is now triggered one page earlierready
event is now actually triggered at least once
Specific changes for extensions.
extension.bind
is now called duringbind
instead ofinitialize
extension.unbind
is added and called duringunbind
render
is now triggered before rendering, userendered
when rendering is completeload
is now triggered before loading, useloaded
when loading is complete
thresholdMargin
option has been replaced withnegativeMargin
loaderDelay
option has been replaced withdelay
trigger
option has been replaced by the IASTriggerExtensions'text
optionloader
option has been replaced by the IASSpinnerExtensions'html
optionnoneleft
option has been replaced by the IASNoneLeftExtensions'text
optionscrollContainer
option has been removed. You can now do:$('<scrollContainer>').ias({...})
onPageChange
option has been replaced by the IASPagingExtensions'pageChange
eventonLoadItems
option has been replaced by theload
eventonRenderComplete
option has been replaced by therender
eventonScroll
option has been replaced by thescroll
eventcustomLoaderProc
option has been replaced by the IASSpinnerExtensionshtml
optioncustomTriggerProc
option has been replaced by the IASTriggerExtensionshtml
option