JavaScript Triggers

Sébastien Dumont edited this page Dec 26, 2016 · 2 revisions

As of version 1.4.8 the JavaScript of Auto Load Next Post has triggers that can be used.

When viewing another post.

This is triggered when the browser updates to the new post.

jQuery('body').trigger( 'alnp-post-changed', [ this_title, this_url, this_post_id, post_count, stop_reading ] );

Override Post URL

This is triggered before the post is fetched. This is useful should you wish to change the url of the next post to load after X amount of posts.

jQuery('body').trigger( 'alnp-post-url', [ post_count, post_url ] );

Manipulate Post Data

Can be used to manipulate the post data. This is triggered before the post is appended.

jQuery('body').trigger( 'alnp-post-data', [ post ] );

Once a post has loaded.

Can be used to do anything once a post has loaded. For example set the variable "stop_reading" to "true" to stop further posts from loading after X amount of posts have loaded.

jQuery('body').trigger( 'alnp-post-loaded', [ post_title.text(), post_url, post_ID, post_count ] );