Skip to content

Commit

Permalink
0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ximan committed Dec 18, 2015
1 parent a5f8a62 commit 9a489e7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
6 changes: 5 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
### 0.6.0(151218)

* 增加参数threshold提前加载距离

### 0.5.0(151217)

* 上拉加载改为滑到底部自动加载
* 删除上拉加载中的↑释放更新
* 增加无数据`me.noData()` API
* 增加无数据`noData()` API

### 0.4.0(150927)

Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## 背景介绍

### 0.6.0(151218)

根据网友提议增加提前加载距离threshold,适用于上拉加载更多功能。默认显示到加载区高度2/3时加载。

### 0.5.0(151217)

感谢交流群里网友各种吐槽上拉加载抖动。发现`touch``scroll`同时作用会发生抖动,干脆把上拉加载改为滑到底部自动加载。如依旧需要上拉加载效果,可以下载[releases0.4.0版本](https://github.com/ximan/dropload/releases/tag/0.4.0)
Expand Down Expand Up @@ -79,6 +83,7 @@ $('.element').dropload({
| domUp | 上方DOM | {<br/>domClass : 'dropload-up',<br/>domRefresh : '&lt;div class="dropload-refresh"&gt;↓下拉刷新&lt;/div&gt;',<br/>domUpdate : '&lt;div class="dropload-update"&gt;↑释放更新&lt;/div&gt;',<br/>domLoad : '&lt;div class="dropload-load"&gt;○加载中...&lt;/div&gt;'<br/>} | 数组 |
| domDown | 下方DOM | {<br/>domClass : 'dropload-down',<br/>domRefresh : '&lt;div class="dropload-refresh"&gt;↑上拉加载更多&lt;/div&gt;',<br/>domLoad : '&lt;div class="dropload-load"&gt;○加载中...&lt;/div&gt;',<br/>domNoData : '&lt;div class="dropload-noData"&gt;暂无数据&lt;/div&gt;'<br/>} | 数组 |
| distance | 拉动距离 | 50 | 数字 |
| threshold | 提前加载距离 | 加载区高度2/3 | 正整数 |
| loadUpFn | 上方function || function(me){<br/>//你的代码<br/>me.resetload();<br/>} |
| loadDownFn | 下方function || function(me){<br/>//你的代码<br/>me.resetload();<br/>} |

Expand All @@ -94,11 +99,9 @@ $('.element').dropload({

## 最新版本

### 0.5.0(151217)
### 0.6.0(151218)

* 上拉加载改为滑到底部自动加载
* 删除上拉加载中的↑释放更新
* 增加无数据`me.noData()` API
* 增加参数threshold提前加载距离

[所有更新日志](Changelog.md)

Expand Down
13 changes: 10 additions & 3 deletions dist/dropload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* dropload
* 西门
* 0.5.0(151217)
* 0.6.0(151218)
*/

;(function($){
Expand Down Expand Up @@ -46,6 +46,7 @@
domNoData : '<div class="dropload-noData">暂无数据</div>'
},
distance : 50, // 拉动距离
threshold : '', // 提前加载距离
loadUpFn : '', // 上方function
loadDownFn : '' // 下方function
}, options);
Expand Down Expand Up @@ -101,8 +102,14 @@
// 加载下方
me.$scrollArea.on('scroll',function(){
me._scrollTop = me.$scrollArea.scrollTop();
// 当滑到加载区2/3处时加载
if(me.opts.loadDownFn != '' && !me.loading && !me.isLock && (me._scrollContentHeight - Math.floor(me.$domDown.height()*1/3)) <= (me._scrollWindowHeight + me._scrollTop)){
if(me.opts.threshold === ''){
// 默认滑到加载区2/3处时加载
me._threshold = Math.floor(me.$domDown.height()*1/3);
}else{
me._threshold = me.opts.threshold;
}

if(me.opts.loadDownFn != '' && !me.loading && !me.isLock && (me._scrollContentHeight - me._threshold) <= (me._scrollWindowHeight + me._scrollTop)){
me.direction = 'up';
me.$domDown.html(me.opts.domDown.domLoad);
me.loading = true;
Expand Down
4 changes: 2 additions & 2 deletions dist/dropload.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion examples/load-top-bottom.html
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ <h3>12文字描述文字描述文字描述文字描述文字描述</h3>
me.resetload();
}
});
}
},
threshold : 50
});
});
</script>
Expand Down

0 comments on commit 9a489e7

Please sign in to comment.