Infinite scroll plugin keeps appending the same content.

Infinite scroll plugin keeps appending the same content.

So the jquery plugin I'm using keeps on contentiously appending the same content. I want it to append content from a list of images in my html, but when infinite scroll appends the content when I reach the bottom of the page, it keeps getting appended continuously as I continue scrolling again. I only want it appended once, not multiple times.

Here's the endless scroll plugin:

  1. $(window).scroll(function () { 
  2.        if ($(window).scrollTop() >= $(document).height() - $(window).height() - 10) {
  3.            $(document.body).append($("ul#next").html());
  4.        }
  5.     });
What I've been trying to accomplish:

I need the images within the "next" id to be appended to the "images" id when the user scrolls. 

  1. <ul id="images"> <li>image link</li> </ul>

  2. <ul id="next"> <li>image link</li> </ul>