Currently I have the following code which detects when a user has started scrolling and if they've reached the center of the page.
$(window).scroll(function() { if ($(window).scrollTop() > $(window).height() / 2) { //Load more posts } });
However the problem I have is that whenever a user starts scrolling, the above script fires. So if a user scrolls up to view previous posts, this loads more posts. If a user is in the center and scrolls just a tiny bit, the script loads more posts.
My question is, is there a way to determine when a user has started to scroll down AND has reached the center of the newly resized page, because of more appended posts.
Thanks