Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

初始化必须加载数据一次 #119

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.DS_Store
*.DS_Store
.idea
12 changes: 12 additions & 0 deletions dist/dropload.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
me.isData = true;
me._scrollTop = 0;
me._threshold = 0;
// 是否是首次加载默认是
me.initLoad = true;
me.init(options);
};

Expand Down Expand Up @@ -209,6 +211,12 @@
// 如果文档高度不大于窗口高度,数据较少,自动加载下方数据
function fnAutoLoad(me){
if(me.opts.loadDownFn != '' && me.opts.autoLoad){

// 第一次必须加载,不用比较dom文档高度和win窗口高度,加载完后设置initLoad=false;
if (me.initLoad) {
return loadDown(me);
}

if((me._scrollContentHeight - me._threshold) <= me._scrollWindowHeight){
loadDown(me);
}
Expand All @@ -230,6 +238,10 @@
me.$domDown.html(me.opts.domDown.domLoad);
me.loading = true;
me.opts.loadDownFn(me);
// 只要加载一次就设置me.initLoad=false
if (me.initLoad) {
me.initLoad = false;
}
}

// 锁定
Expand Down