Original: http://www.sitepoint.com/jquery-infinite-scrolling-demos/
Infinite scrolling Demo 5usage–html
<ulclass= "Items"> <Li>Content</Li> <Li>Content</Li> ...</ul><DivID= "Lastpostsloader"></Div>
Usage–jquery
<script type= "Text/javascript" >$ (document). Ready (function(){ functionLastaddedlivefunc () {$ (' Div#lastpostsloader '). html (' '); $.get ("Loadmore.php",function(data) {if(Data! = "") { //console.log (' Add data. ');$ (". Items"). append (data); } $(' Div#lastpostsloader '). empty (); }); }; //Lastaddedlivefunc ();$ (window). Scroll (function(){ varWintop = $ (window). scrolltop (), Docheight = $ (document). Height (), winheight =$ (window). Height (); varScrolltrigger = 0.95; if((wintop/(docheight-winheight)) > Scrolltrigger) {//console.log (' scroll bottom ');Lastaddedlivefunc (); } });});</script>
Infinite scrolling Demo 3
This demo loads in images on infinite scroll and never reaches the end. It uses the Jquery.endless-scroll plugin which can be customised to trigger load for x number of pixels from the bottom of The screen. The demo clones the same images and inserts them at the end of the list and so on. Obviously the script can customised to load more images from different sources quite easily
Usage–html
<ulID= "Images"> <Li><imgsrc= "Img/grass-blades.jpg"width= "580"Height= " the"alt= "Grass Blades" /></Li> <Li><imgsrc= "Img/stones.jpg"width= "580"Height= " the"alt= "Stones" /></Li> <Li><imgsrc= "Img/sea-mist.jpg"width= "580"Height= " the"alt= "Sea Mist" /></Li> <Li><imgsrc= "Img/pier.jpg"width= "580"Height= " the"alt= "Pier" /></Li> <Li><imgsrc= "Img/lotus.jpg"width= "580"Height= " the"alt= "Lotus" /></Li> <Li><imgsrc= "Img/mojave.jpg"width= "580"Height= " the"alt= "Mojave" /></Li> <Li><imgsrc= "Img/lightning.jpg"width= "580"Height= " the"alt= "Lightning" /></Li></ul>
Usage–jquery
<script type= "Text/javascript" src= "js/jquery.endless-scroll.js" ></script><script type= "text/ JavaScript "charset=" Utf-8 "> $ ( function () {$ (document). Endlessscroll ({bottompixels: 500, Firedelay: 10 function
(i) { var last_img = $ ("Ul#images Li : Last "); Last_img.after (Last_img.prev (). Prev (). Prev (). Prev (). Prev (). Prev (). Clone ()); } }); }); </script>
var end = $ ("#BottomThing"var viewend = $ (window). scrolltop () + $ (window). Height (); var distance = end- viewend; if // Do load–
Turn JS Infinite scrolling Demo