Turn JS Infinite scrolling Demo

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.