forked from fredwu/jquery-endless-scroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
91 lines (85 loc) · 2.68 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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: #cee; font-family: Helvetica, Arial, Verdana, 'Lucida Grande', sans-serif; }
h1, h3, p { text-align: center; }
ul#list { width: 50px; height: 200px; overflow-y: scroll; }
ul#images { 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() {
$('ul#list').endlessScroll({
fireOnce: false,
insertAfter: "ul#list div:last",
data: function(i) {
console.log(i)
return '<li>' + i + '</li>'
},
ceaseFire: function(i) {
if (i >= 10) {
return true;
}
},
intervalFrequency: 5
});
$(window).endlessScroll({
bottomPixels: 500,
fireDelay: 10,
callback: function(i) {
console.log(i)
var last_img = $("ul#images li:last");
last_img.after(last_img.prev().prev().prev().prev().prev().prev().clone());
}
});
});
</script>
</head>
<body>
<h1>Endless Scroll Demo</h1>
<h3>by Fred Wu</h3>
<br /><br />
<p>Stops after 10 calls.</p>
<br />
<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>
<br /><br />
<p>Never stops.</p>
<br />
<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>
</ul>
</body>
</html>