Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
106 lines (96 sloc) 3.301 kb
<!DOCTYPE html>
<html xmlns="" xml:lang="en" lang="en">
<title>Endless Scroll Demo (by Fred Wu)</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<style type="text/css" media="screen">
* { margin: auto; }
body { margin: 20px 0; background: #abc; color: #111; font-family: Helvetica, Arial, Verdana, 'Lucida Grande', sans-serif; }
h1, h3, p { text-align: center; }
div.example { padding: 20px; margin: 10px auto; background: #bcd; width: 750px; }
div.example h3 { margin-bottom: 10px; }
ul, ol { padding: 0; }
#list { width: 50px; height: 150px; overflow-y: scroll; }
#images { width: 600px; height: 550px; overflow-x: hidden; text-align: center; list-style: none; }
.endless_scroll_loader { position: fixed; top: 10px; right: 20px; }
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.endless-scroll.js"></script>
<script type="text/javascript" charset="utf-8">
$(function() {
pagesToKeep: 10,
fireOnce: false,
insertBefore: "#list div:first",
insertAfter: "#list div:last",
content: function(i, p) {
console.log(i, p)
return '<li>' + p + '</li>'
ceaseFire: function(i) {
if (i >= 10) {
return true;
intervalFrequency: 5
var images = $("ul#images").clone().find("li");
pagesToKeep: 5,
inflowPixels: 100,
fireDelay: 10,
content: function(i, p, d) {
console.log(i, p, d)
return images.eq(Math.floor(Math.random()*8))[0].outerHTML;
<h1>Endless Scroll Demo</h1>
<h3>by <a href="">Fred Wu</a></h3>
<div class="example">
<h3>Ends in 10 calls:</h3>
<ul id="list">
<div class="example">
<h3>Never ending:</h3>
<ul id="images">
<li><img src="img/grass-blades.jpg" width="580" height="360" alt="Grass Blades" /></li>
<li><img src="img/stones.jpg" width="580" height="360" alt="Stones" /></li>
<li><img src="img/sea-mist.jpg" width="580" height="360" alt="Sea Mist" /></li>
<li><img src="img/pier.jpg" width="580" height="360" alt="Pier" /></li>
<li><img src="img/lotus.jpg" width="580" height="360" alt="Lotus" /></li>
<li><img src="img/mojave.jpg" width="580" height="360" alt="Mojave" /></li>
<li><img src="img/lightning.jpg" width="580" height="360" alt="Lightning" /></li>
<li><img src="img/flowing-rock.jpg" width="580" height="360" alt="Grass Blades" /></li>
<div class="example">
<p>Copyright &copy; <a href="">Fred Wu</a></p>
Jump to Line
Something went wrong with that request. Please try again.