Callback Functions
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 simply copy and paste a code example below into your sites JavaScript file.
Change
almOnChange() is dispatched at the beginning of each Ajax Load More query.
1 2 3 |
window.almOnChange = function(alm){ console.log("Ajax Load More is loading..."); }; |
Are you looking for examples?
You’re in luck, we are compiling a list of callback examples in use by Ajax Load More users.
Complete
almComplete() is dispatched after every successful Ajax Load More query – Learn More.
1 2 3 |
window.almComplete = function(alm){ console.log("Ajax Load More Complete!"); }; |
Are you looking for examples?
You’re in luck, we are compiling a list of callback examples in use by Ajax Load More users.
Destroyed
almDestroyed() is dispatched after the destroy_after shortcode parameter is triggered.
1 2 3 |
window.almDestroyed = function(alm){ console.log("Ajax Load More functionality has been destroyed!"); }; |
Done
almDone() is dispatched after all posts have been loaded and there are zero posts remaining.
1 2 3 |
window.almDone = function(){ console.log('All posts have been loaded!'); }; |
Empty
almEmpty() is dispatched when zero results are returned in the initial Ajax Load More query.
1 2 3 4 5 6 7 8 9 10 |
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 :("); }; |
Filter Complete
almFilterComplete() is dispatched after a successful call to the public function almFilter().
1 2 3 |
window.almFilterComplete = function(){ console.log('Ajax Load More filter has completed!'); }; |
Load
almOnLoad() is dispatched when Ajax Load More initializes.
1 2 3 |
window.almOnLoad = function(alm){ console.log("Ajax Load More is now loaded"); }; |
URL Update
almUrlUpdate() is dispatched after a successful URL update (pushState) from the Previous Post and Search Engine Optimization add-on.
1 2 3 4 5 |
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.'); }; |
Note: Your sites JavaScript functions file must be loaded after Ajax Load More in order to trigger these callbacks.