Public JS Functions

The following public JavaScript functions allow for the manipulation of Ajax Load More instances.


Click

ajaxloadmore.click(id) – This function will allow you to trigger an Ajax Load More load action from any element on the screen.

id The Ajax Load More ID. null

Filter

ajaxloadmore.filter(transition, speed, data) – This function will allow you to update Ajax Load More parameters on the fly and provide a clean transition between each filter.
» View Example

The filter() method requires the following parameters:

transition Select a transition type. ‘fade’ | null
speed The speed of the transition, in milliseconds. e.g. ‘300’
data The data() object that holds the parameters for updating.
Note: When filtering, underscores in shortcode attributes must be converted to dashes.
e.g. button_label = button-label


Reset

ajaxloadmore.reset() – This function will allow you to reset Ajax Load More back to page 1 of a listing. This function is useful in cases where content may have changed and Ajax Load More is required to be started from the beginning.


Start

ajaxloadmore.start(element) – This function will initiate an instance of Ajax Load More. This is most commonly used when Ajax Load More has been loaded via Ajax.


getPostCount

ajaxloadmore.getPostCount() – This function will return the loaded post count in the current query by ALM instance ID.

Note: The ID parameter in the getPostCount function is optional and will fall back to the default instance if not present.


getTotalPosts

ajaxloadmore.getTotalPosts() – This function will return the total number of posts in the entire query by ALM instance ID.

Note: The ID parameter in the getTotalPosts function is optional and will fall back to the default instance if not present.


getTotalRemaining

ajaxloadmore.getTotalRemaining() – This function will return the total number of posts remaining to be loaded  by ALM instance ID.

Note: The ID parameter in the getTotalRemaining function is optional and will fall back to the default instance if not present.