almComplete()
Dispatched after every successful Ajax Load More query..
Each Javascript callback function is dispatched directly from core Ajax Load More or one of the various add-ons. To utilize the following callback functions copy and paste a code example below into your site’s JavaScript file.
almOnChange() is dispatched at the beginning of each Ajax Load More query.
window.almOnChange = function(alm){
console.log("Ajax Load More is loading...");
};
JavaScriptalmComplete() is dispatched after every successful Ajax Load More query – Learn More.
window.almComplete = function(alm){
console.log("Ajax Load More Complete!");
};
JavaScriptNote: The alm object returned in the callback contains information about the current Ajax Load More instance. You can locate the most recently added content by accessing the el attribute of the alm object.
window.almComplete = function(alm){
console.log( alm.last_loaded ); // <- Returns array of most recently loaded HTML elements.
};
JavaScriptAre you looking for examples?
You’re in luck, we are compiling a list of callback examples in use by Ajax Load More users.
almDestroyed() is dispatched after the destroy_after shortcode parameter is triggered.
window.almDestroyed = function(alm){
console.log("Ajax Load More functionality has been destroyed!");
};
JavaScriptalmDone() is dispatched after all posts have been loaded and there are zero posts remaining.
window.almDone = function(){
console.log('All posts have been loaded!');
};
JavaScriptalmEmpty() is dispatched when zero results are returned in the initial Ajax Load More query.
window.almEmpty = function(alm){
var el = alm.listing;
var msg = 'Sorry, nothing found in this Ajax Load More query';
var item = document.createElement('li');
item.innerHTML = msg;
el.appendChild(item); // Append to ALM
//console.log("Nothing found in this Ajax Load More query :(");
};
JavaScriptalmFilterComplete() is dispatched after a successful call to the public function almFilter().
window.almFilterComplete = function(){
console.log('Ajax Load More filter has completed!');
};
JavaScriptalmOnLoad() is dispatched when Ajax Load More initializes.
window.almOnLoad = function(alm){
console.log("Ajax Load More is now loaded");
};
JavaScriptalmUrlUpdate() is dispatched after a successful URL update (pushState) from the Single Post, Filters and Search Engine Optimization add-on.
window.almUrlUpdate = function(permalink, type){
// type = From which addon (previous-post | seo)
// permalink = the updated url
console.log("URL updated to " + permalink + '- dispatched from the '+ type + ' add-on.');
};
JavaScriptNote: Your site JavaScript functions file must be loaded after Ajax Load More to trigger callbacks.