DocumentationOnline documentation for Ajax Load More
Paging
Developer documentation for the Ajax Load More Paging add-on.
Callback Functions
The following JavaScript callbacks are available when using this add-on:
almPagingComplete
The almPagingComplete callback is dispatched once the pagination DOM elements have completed any transitions following an Ajax request. This callback will allow you to run custom functions or manipulate DOM elements once the loading of the Paging add-on has finished.
window.almPagingComplete = function(){
console.log( 'Callback: Paging has completed' );
};
JavaScriptIn the following code sample, the user is scrolled to the top of the Ajax Load More listing.
var pagingInit = true;
window.almPagingComplete = function(){
if (!pagingInit){
var alm = document.querySelector('#ajax-load-more');
if(alm){
window.scrollTo({
top: alm.offsetTop - 30, // Offset the scroll by 30 pixels.
behavior: 'smooth',
});
}
}
pagingInit = false;
};
JavaScript