Browse Source

scroll

master
Pascal Gloor 5 years ago
parent
commit
cf588ffbaa
1 changed files with 15 additions and 9 deletions
  1. 15
    9
      www/js/autodoc.js

+ 15
- 9
www/js/autodoc.js View File

@@ -7,12 +7,14 @@ var conf = {
home: "page_load_home()"
},
home: {
width: 4
width: 4,
curpage: 0
}
};

$(document).ready(function() {
change_page();
$.scroll(function() { page_home_scroll();
});

$(window).bind("hashchange", function() {
@@ -68,13 +70,12 @@ function isvisible(obj) {
}

function page_load_home() {
document_load(0);
document_load();
}

function document_load(page) {
if (!page || page == 0) {
function document_load() {
if (conf.home.curpage == 0) {
$("#autodoc_home_body").html("");
page = 0;
}

var tmpl = $("#autodoc_template_home");
@@ -87,7 +88,7 @@ function document_load(page) {
"/documents?pageSize=" +
conf.home.width +
"&pageIndex=" +
page,
conf.home.curpage,
null,
function(data, textStatus, jqXHR) {
$.each(data, function(id, doc) {
@@ -126,9 +127,14 @@ function document_load(page) {
});
$("#autodoc_home_body").append(row);
// continue to load until out of browser.
if (isvisible($(".autodoc_template_home_col").last())) {
document_load(page + 1);
}
page_home_scroll();
}
);
}

function page_home_scroll() {
if (isvisible($(".autodoc_template_home_col").last())) {
conf.home.curpage++;
document_load();
}
}

Loading…
Cancel
Save