I have an AJAX function running in Wordpress to fetch 5 of the latest posts, but I would like to run this function only when the user scrolls to a point on the page where a specific div is visible - is this possible using jQuery?
My code so far looks like…
jQuery.ajax({
    type: 'POST',
    url: '/wp-admin/admin-ajax.php',
    data: {
        action: 'get_latest', // the PHP function to run
    },
    success: function(data, textStatus, XMLHttpRequest) {
        jQuery('#posts-load').html(''); // empty an element
        jQuery('#posts-load').append(data); // put our list of links into it
    }
});
 
     
    