Infinite looping scroll

My working example with infinite looping using jquery.

by fido3993

HTML

<div class="test">
<div class="set" id="scrollbox">
<p>
Hello
</p>
<p>
Hello
</p>
<p>
Hello
</p>
<p>
Hello
</p>
<p>
Hello
</p>
</div>
</div>

CSS

p{
  display:inline-block;
  margin:0 80px;
}

.set{
      white-space: nowrap;
}

.test{
  width:1000px;
}

JavaScript

$(window).scroll(function () {
     if ($(window).scrollLeft() >= $(document).width() - $(window).width() - 10) {
          setTimeout(function() {
            var box = $("#scrollbox");
            var aj = $(".set");   
            box.html(box.html() + aj.html());
            
          }, 100);
      }
 });