Skip to content

Commit

Permalink
0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ximan committed Apr 10, 2015
1 parent 4e7c800 commit ae1a192
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 18 deletions.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 0.3.0(150410)

* 增加`lock()``unlock()` API
* 修复拉动加载时还可拉动bug

### 0.2.0(150325)

* 修改参数domUp、domDown,增加参数loadUpFn、loadDownFn,删除参数direction
Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

## 背景介绍

### 0.3.0(150410)

项目中通知列表有可编辑、删除等状态,需要锁定和解锁下拉刷新功能。

### 0.2.0(150325)

公司项目APP内嵌页需要下拉刷新,终于可以实战了!这一版大家可以开始使用和反馈。
Expand Down Expand Up @@ -72,11 +76,19 @@ CSS样式请自行美化
| loadUpFn | 上方function || function(me){<br/>//你的代码<br/>me.resetload();<br/>} |
| loadDownFn | 下方function || function(me){<br/>//你的代码<br/>me.resetload();<br/>} |

## API

暴露一些功能,可以让dropload更灵活的使用

`lock()` 锁定dropload

`unlock()` 解锁dropload

## 最新版本

### 0.2.0(150325)
### 0.3.0(150410)

* 修改参数domUp、domDown,增加参数loadUpFn、loadDownFn,删除参数direction
* 增加`lock()``unlock()` API
* 修复拉动加载时还可拉动bug

[所有更新日志](Changelog.md)
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dropload",
"version": "0.2.0",
"version": "0.3.0",
"homepage": "https://github.com/ximan/dropload",
"authors": [
"ximan"
Expand Down
35 changes: 26 additions & 9 deletions dist/dropload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* dropload
* 西门
* 0.2.0(150325)
* 0.3.0(150410)
*/

;(function($){
Expand All @@ -14,6 +14,7 @@
me.$element = $(element);
me.insertDOM = false;
me.loading = false;
me.isLock = false;
me.init(options);
};

Expand All @@ -39,19 +40,23 @@
}, options);

// 绑定触摸
if(!me.loading){
me.$element.on('touchstart',function(e){
me.$element.on('touchstart',function(e){
if(!me.loading && !me.isLock){
fnTouches(e);
fnTouchstart(e, me);
});
me.$element.on('touchmove',function(e){
}
});
me.$element.on('touchmove',function(e){
if(!me.loading && !me.isLock){
fnTouches(e, me);
fnTouchmove(e, me);
});
me.$element.on('touchend',function(){
}
});
me.$element.on('touchend',function(){
if(!me.loading && !me.isLock){
fnTouchend(me);
});
}
}
});
};

// touches
Expand Down Expand Up @@ -176,6 +181,18 @@
}
}

// 锁定
MyDropLoad.prototype.lock = function(){
var me = this;
me.isLock = true;
};

// 解锁
MyDropLoad.prototype.unlock = function(){
var me = this;
me.isLock = false;
};

// 重置
MyDropLoad.prototype.resetload = function(){
var me = this;
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.

46 changes: 42 additions & 4 deletions examples/product-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,31 @@
flex-direction:column;
}
.header{
position: relative;
height: 44px;
line-height: 44px;
text-align: center;
border-bottom: 1px solid #ccc;
background-color: #eee;
}
.header h1{
text-align: center;
font-size: 2rem;
font-weight: normal;
background-color: #eee;
}
.header .btn{
position: absolute;
right: 0;
top: 0;
width: 4em;
height: 100%;
text-align: center;
color: #06c;
font-size: 1.4rem;
background-color: #ccc;
}
.header .btn:active{
background-color: #aaa;
color: #fff;
}
.inner{
-webkit-box-flex: 1;
Expand Down Expand Up @@ -169,7 +187,10 @@
</head>
<body>
<div class="outer">
<h1 class="header">头部</h1>
<div class="header">
<h1>头部</h1>
<a href="javascript:;" class="btn lock">锁定</a>
</div>
<div class="inner">
<div class="lists">
<a class="item">
Expand Down Expand Up @@ -238,7 +259,24 @@ <h3>12文字描述文字描述文字描述文字描述文字描述</h3>
<script src="js/zepto.min.js"></script>
<script src="../dist/dropload.min.js"></script>
<script>
$('.inner').dropload({
// 按钮操作
$('.header .btn').on('click',function(){
var $this = $(this);
if(!!$this.hasClass('lock')){
$this.attr('class','btn unlock');
$this.text('解锁');
// 锁定
dropload.lock();
}else{
$this.attr('class','btn lock');
$this.text('锁定');
// 解锁
dropload.unlock();
}
});

// dropload
var dropload = $('.inner').dropload({
domUp : {
domClass : 'dropload-up',
domRefresh : '<div class="dropload-refresh">↓下拉刷新</div>',
Expand Down

0 comments on commit ae1a192

Please sign in to comment.