Jetpack 8.4 and Lazy Images

Mauer Themes Support Stills Jetpack 8.4 and Lazy Images

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3806
    Nico
    Participant

    Did you try the image lazy loading feature with the “load more” button in the portfolio view with a recent Jetpack installation?
    In the recent version, the internal event name has changed, so when lazy loading is enabled, new images are not loaded anymore when clicking on “load more”.

    In general.js (the main theme’s JS file), the “is.post-load” event needs to be triggered (see the “Jetpack >= 8.4” line in the following code snippet). In order to stay compatible with older Jetpack installations, the second (original) “trigger” could stay in place.

    				// trigger Jetpack lazy loading for newly added content
    				document.body.dispatchEvent(new Event('is.post-load')); // Jetpack >= 8.4
    				$(document.body).trigger('post-load'); // Jetpack < 8.4
    
    #3901
    Paul
    Keymaster

    Nico, I really appreciate you having posted this.
    This event will make its way into the next theme update.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.