Async Load WordPress Post

Async Load WordPress Post

Reference

Load Infinite AJAX Scroll

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/js/jquery-ias.min.js" type="text/javascript"></script>

Add Class to Pagination

add_filter('next_posts_link_attributes', 'posts_link_attributes');

function posts_link_attributes() {
    return 'class="next-posts"';
}

Chris's comment(The first one)

Initiate the instance

<script type="text/javascript">
   var ias = $.ias({
     container: "#content",
     item: ".post",
     pagination: ".navigation",
     next: ".nav-previous a",
   });

   ias.extension(new IASTriggerExtension({
                                       offset: 2
                                       text: '加载更多',
                                       }));
   ias.extension(new IASSpinnerExtension());
   ias.extension(new IASNoneLeftExtension());
</script>