Site logo

Archived topic

jquery event on load more posts in infinite scroll

5 replies · Started by Joshua Vandercar on August 9, 2018

Viewing posts 1–6 of 6

I'd like to run a jquery function when more posts are loaded via infinite scroll. Is there an event to which I can bind? Thanks!

Yes, I have that enabled. Is there a specific javascript event that is triggered after the additional posts are loaded? I have a function that needs to target and modify those elements that are being added to the DOM.

Give this a shot:

jQuery( document ).ready( function($) {
    var $container = $( '#main article' ).first().parent();

    $container.on( 'append.infiniteScroll', function( event, response, path, items ) {
        // Do stuff
    } );
} );

Make sure to load this JS only on pages that have infinite scroll initiated.

Let me know :)

Yes! Thank you, Tom! That got the job the done.

Awesome! You're welcome :)

This archived topic is closed to new replies.