Well, here is one way to do this:
$(document).ready( function(){ $(window).scroll( function(){ if ($(window).scrollTop() + $(window).height() >= $(document).height()) { $('div').clone().appendTo('body'); } } ); } );
With props JS Fiddle demo .
Keep in mind that any interactive content that will be cloned / added / inserted dynamically will require some kind of live() or delegate() to interact with jQuery.
However, there are reservations:
- Endless scrolling is not necessarily a pleasant navigational aid, especially if the user is likely to want to view some of the content halfway down an endless page.
- There comes a time when the browser crashes or becomes sluggish / unresponsive due to the huge amount of content that it must support in memory.
source share