Skip to content

Commit

Permalink
第一次直接渲染10个
Browse files Browse the repository at this point in the history
  • Loading branch information
brown committed Mar 17, 2020
1 parent b6d96c5 commit b8cd88f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/static/js/common.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
function scroll_load(list_element, list_data, item_template, template_func) {
list_element.innerHTML = '';
let index = 0;
while ($(window).height() > $("body").height()) { // 渲染到满屏
render_items(5);
}
render_items(10);
$(document).scroll(function () {
if ($("body").height() - $(document).scrollTop() - $(window).height() < 300) { // 滑动到距底部300像素时再加载
render_items(5);
Expand Down

0 comments on commit b8cd88f

Please sign in to comment.