-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
616 additions
and
1,102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
### 0.2.0(150325) | ||
|
||
* 修改参数domUp、domDown,增加参数loadUpFn、loadDownFn,删除参数direction | ||
|
||
### 0.1.0(141024) | ||
|
||
* 支持上/下拉 | ||
* 支持自定义拉动的DOM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,82 @@ | ||
# dropload | ||
|
||
移动端下拉刷新(基于Zepto/jQuery) | ||
移动端下拉刷新、上拉加载更多插件 | ||
|
||
### v0.1.0: | ||
## 背景介绍 | ||
|
||
* 支持上/下拉 | ||
* 支持自定义拉动的DOM | ||
### 0.2.0(150325) | ||
|
||
公司项目APP内嵌页需要下拉刷新,终于可以实战了!这一版大家可以开始使用和反馈。 | ||
|
||
### 0.1.0(141024) | ||
|
||
虽然有**上拉加载更多**的需求,但一直都是用的scroll方法。写**dropload**完全是为了练习插件写法和touch的使用。 | ||
|
||
## 示例 | ||
|
||
![扫一扫](examples/product-list.png) | ||
[DEMO链接](http://ximan.github.io/dropload/examples/product-list.html) | ||
|
||
## 依赖 | ||
|
||
Zepto 或者 jQuery | ||
|
||
## 使用方法 | ||
|
||
```` | ||
$('.element').dropload({ | ||
loadUpFn : function(me){ | ||
$.ajax({ | ||
type: 'GET', | ||
url: 'json/update.json', | ||
dataType: 'json', | ||
success: function(data){ | ||
alert(data); | ||
// 代码执行后必须重置 | ||
me.resetload(); | ||
}, | ||
error: function(xhr, type){ | ||
alert('Ajax error!'); | ||
me.resetload(); | ||
} | ||
}); | ||
}, | ||
loadDownFn : function(me){ | ||
$.ajax({ | ||
type: 'GET', | ||
url: 'json/more.json', | ||
dataType: 'json', | ||
success: function(data){ | ||
alert(data); | ||
// 代码执行后必须重置 | ||
me.resetload(); | ||
}, | ||
error: function(xhr, type){ | ||
alert('Ajax error!'); | ||
me.resetload(); | ||
} | ||
}); | ||
} | ||
}); | ||
```` | ||
|
||
CSS样式请自行美化 | ||
|
||
## 参数列表 | ||
|
||
| 参数 | 说明 | 默认值 | 可填值 | | ||
|------------|-------------|--------|----------------| | ||
| domUp | 上方DOM | {<br/>domClass : 'dropload-up',<br/>domRefresh : '<div class="dropload-refresh">↓下拉刷新</div>',<br/>domUpdate : '<div class="dropload-update">↑释放更新</div>',<br/>domLoad : '<div class="dropload-load">○加载中...</div>'<br/>} | 数组 | | ||
| domDown | 下方DOM | {<br/>domClass : 'dropload-down',<br/>domRefresh : '<div class="dropload-refresh">↑上拉加载更多</div>',<br/>domUpdate : '<div class="dropload-update">↓释放加载</div>',<br/>domLoad : '<div class="dropload-load">○加载中...</div>'<br/>} | 数组 | | ||
| distance | 拉动距离 | 50 | 数字 | | ||
| loadUpFn | 上方function | 空 | function(me){<br/>//你的代码<br/>me.resetload();<br/>} | | ||
| loadDownFn | 下方function | 空 | function(me){<br/>//你的代码<br/>me.resetload();<br/>} | | ||
|
||
|
||
## 最新版本 | ||
|
||
### 0.2.0(150325) | ||
|
||
* 修改参数domUp、domDown,增加参数loadUpFn、loadDownFn,删除参数direction | ||
|
||
[所有更新日志](Changelog.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.