sgroller
This commit is contained in:
parent
1429ea56d5
commit
ebfebc6e09
@ -12,6 +12,7 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<script src="./s/jquery-3.1.0.min.js"></script>
|
||||
<script src="./s/scroller.js"></script>
|
||||
<script src="./s/shit.js"></script>
|
||||
<script src="./s/theme.js"></script>
|
||||
</body>
|
||||
|
18
s/scroller.js
Normal file
18
s/scroller.js
Normal file
@ -0,0 +1,18 @@
|
||||
var load = false;
|
||||
$(()=>{
|
||||
$(window).scroll(()=>{
|
||||
if($(window).scrollTop() + $(window).height() >= $(document).height() - 130 && !load) {
|
||||
load = true;
|
||||
$.getJSON('./api/p/'+$('#posts').data('last'), (msg) => {
|
||||
var html = "";
|
||||
for(var i = 0; i < msg.items.length; i++)
|
||||
if(msg.items[i].id)
|
||||
html += "<li class=\"post\"><a href=\"./"+msg.items[i].id+"\" title=\""+msg.items[i].mime+"\"><img
|
||||
class=\"thumb\" src=\"./t/"+msg.items[i].id+".png\" /></a></li>\n";
|
||||
$('#posts').append(html);
|
||||
$('#posts').data('last', msg.last);
|
||||
load = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user