forked from mdbootstrap/TW-Elements
-
Notifications
You must be signed in to change notification settings - Fork 0
/
infinite-scroll.html
44 lines (39 loc) · 918 Bytes
/
infinite-scroll.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
<!DOCTYPE html>
<html>
<head>
<link href="../css/perfect-scrollbar.css" rel="stylesheet">
<script src="../dist/perfect-scrollbar.js"></script>
<style>
#container {
height: 400px;
width: 100%;
border: 1px solid blue;
overflow: auto;
position: relative;
}
.entryPlaceholder {
height: 48px;
width: 100%;
}
</style>
</head>
<body>
<div id="container">
</div>
<script>
var $ = document.querySelector.bind(document);
var x = 0;
function addEntries() {
for (var i = 0; i < 10; i++) {
$('#container').innerHTML += '<div class="entryPlaceholder">Entry #' + (x++) + '</div>';
}
}
addEntries();
var ps = new PerfectScrollbar('#container');
$('#container').addEventListener('ps-y-reach-end', function () {
addEntries();
ps.update();
});
</script>
</body>
</html>