Wordpress - randomly scrolling Jetpack post-load without firing

I recently started playing with the infinite scroll feature of the wordpress jetpack plugin. Everything seems to work fine, but I'm trying to integrate with Freemasonry, so I need to use the post-load event, which should fire when Jetpack loads more messages.

But I can’t catch it.

I have a very minimal setup (with a supported theme by default, the twenty-fourth) and I added this little script to footer.php to try to catch the event:

    <script type='text/javascript'>
      document.body.addEventListener("post-load", function() {
        alert('posts loaded');
      });
    </script>

But I never get an alert, even if new messages are being downloaded.

Any ideas?

Thanks in advance.

+4
source share
1

, . , , , infinity.js script, Jetpack, 'post-load' jQuery .trigger().

.trigger() , addEventListener.

:

jQuery(document.body).on("post-load", function(e) {
    // your code
})
+1

All Articles