pagination
This commit is contained in:
4
s/jquery-3.1.0.min.js
vendored
Normal file
4
s/jquery-3.1.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,3 +1,6 @@
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
width: 100%;
|
||||
margin: 1em auto 3em auto;
|
||||
|
18
s/test.js
Normal file
18
s/test.js
Normal file
@ -0,0 +1,18 @@
|
||||
$(document).ready(function() {
|
||||
$(window).scroll(function() {
|
||||
if($(window).scrollTop() == $(document).height() - $(window).height()) {
|
||||
$.ajax({
|
||||
url: './api/p/'+$('#posts').data('last'),
|
||||
dataType: 'json',
|
||||
success: function(msg) {
|
||||
var html = "";
|
||||
for(var i = 0; i < msg.items.length; i++)
|
||||
if(msg.items[i].id)
|
||||
html += "<a href=\"./"+msg.items[i].id+"\" title=\""+msg.items[i].mime+"\"><img class=\"thumb\" src=\"./t/"+msg.items[i].id+".png\" /></a>\n";
|
||||
$('#posts').append(html);
|
||||
$('#posts').data('last', msg.last);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
@ -5,12 +5,17 @@
|
||||
<link rel="icon" type="image/gif" href="./s/favicon.gif" />
|
||||
<link rel="stylesheet" type="text/css" href="./s/test.css">
|
||||
</head>
|
||||
<div class="body">
|
||||
{% for item in items %}
|
||||
<a href="./{{ item.id }}" title="{{ item.mime }}"><img class="thumb" src="./t/{{ item.id }}.png" /></a>
|
||||
{% endfor %}
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<body>
|
||||
<div class="body">
|
||||
<div id="posts" data-last="{{ last }}">
|
||||
{% for item in items %}
|
||||
<a href="./{{ item.id }}" title="{{ item.mime }}"><img class="thumb" src="./t/{{ item.id }}.png" /></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div style="position: fixed; top:0;right:0" id="debug"></div>
|
||||
<script src="./s/jquery-3.1.0.min.js"></script>
|
||||
<script src="./s/test.js"></script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user