提交 88febbd3 编写于 作者: C Catouse

* fix rememberPos options of modal and modal trigger and update document.

上级 bd2c3fea
......@@ -273,7 +273,7 @@ $('#myModal').modal(options)
<td>* `false`(默认),不记住位置;
* `true`,记住位置;
* 页面内值唯一的字符串,使用本地存储记住位置;</td>
<td>当该值为一个在页面范围内值唯一的字符串时,通过浏览器本地存储来存储数据,关闭页面或浏览器之后也不会忘记。</td>
<td>启用该选项需要同时启用 `moveable` 选项,当该值为一个在页面范围内值唯一的字符串时,通过浏览器本地存储来存储数据,关闭页面或浏览器之后也不会忘记。</td>
</tr>
</tbody>
</table>
......
......@@ -402,6 +402,14 @@ myModalTrigger.show();
* `true`,启用;</td>
<td>是否启用对话框拖拽移动功能</td>
</tr>
<tr>
<td>`rememberPos`</td>
<td>记住移动的位置</td>
<td>* `false`(默认),不记住位置;
* `true`,记住位置;
* 页面内值唯一的字符串,使用本地存储记住位置;</td>
<td>启用该选项需要同时启用 `moveable` 选项,当该值为一个在页面范围内值唯一的字符串时,通过浏览器本地存储来存储数据,关闭页面或浏览器之后也不会忘记。</td>
</tr>
<tr>
<td>`waittime`</td>
<td>加载远程内容时的最大等待时间</td>
......
......@@ -74,11 +74,12 @@
var topPos = position == 'fit' ? (half * 2 / 3) : (position == 'center' ? half : position);
if($dialog.hasClass('modal-moveable')) {
var pos = null;
if(this.options.rememberPos) {
if(this.options.rememberPos === true) {
var rememberPos = this.options.rememberPos;
if(rememberPos) {
if(rememberPos === true) {
pos = this.$element.data('modal-pos');
} else if($.zui.store) {
pos = $.zui.store.pageGet(zuiname + '.rememberPos');
pos = $.zui.store.pageGet(zuiname + '.rememberPos.' + rememberPos);
}
}
if(!pos) {
......@@ -108,10 +109,11 @@
$dialog.css('margin-top', '').addClass('modal-dragged');
},
finish: function(e) {
if(options.rememberPos) {
var rememberPos = options.rememberPos;
if(rememberPos) {
that.$element.data('modal-pos', e.pos);
if($.zui.store && options.rememberPos !== true) {
$.zui.store.pageSet(zuiname + '.rememberPos', e.pos);
if($.zui.store && rememberPos !== true) {
$.zui.store.pageSet(zuiname + '.rememberPos.' + rememberPos, e.pos);
}
}
}
......
......@@ -278,10 +278,11 @@
}
$modal.modal({
show: 'show',
backdrop: options.backdrop,
moveable: options.moveable,
keyboard: options.keyboard
show : 'show',
backdrop : options.backdrop,
moveable : options.moveable,
rememberPos: options.rememberPos,
keyboard : options.keyboard
});
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册