-
Notifications
You must be signed in to change notification settings - Fork 174
/
index.html
106 lines (96 loc) · 3.22 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<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; }
</style>
<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() {
$('#list').endlessScroll({
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
});
$('#images').scrollTop(101);
var images = $("ul#images").clone().find("li");
$('#images').endlessScroll({
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;
}
});
});
</script>
</head>
<body>
<h1>Endless Scroll Demo</h1>
<h3>by <a href="http://fredwu.me/">Fred Wu</a></h3>
<div class="example">
<h3>Ends in 10 calls:</h3>
<ul id="list">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
<li>13</li>
<li>14</li>
<li>15</li>
<li>16</li>
<li>17</li>
<li>18</li>
<li>19</li>
<li>20</li>
</ul>
</div>
<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>
</ul>
</div>
<div class="example">
<p>Copyright © <a href="http://fredwu.me/">Fred Wu</a></p>
</div>
</body>
</html>