diff --git a/css/ui-dialog.css b/css/ui-dialog.css
index 02ddcd3..6df80d0 100644
--- a/css/ui-dialog.css
+++ b/css/ui-dialog.css
@@ -31,6 +31,12 @@
-webkit-transform: scale(1);
transform: scale(1);
}
+.ui-popup-focus .ui-dialog {
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
+}
+.ui-popup-modal .ui-dialog {
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1), 0 0 256px rgba(255, 255, 255, .3);
+}
.ui-dialog-grid {
width: auto;
margin: 0;
@@ -39,9 +45,6 @@
border-spacing: 0;
background: transparent;
}
-.ui-popup-focus .ui-dialog {
- box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
-}
.ui-dialog-header,
.ui-dialog-body,
.ui-dialog-footer {
@@ -51,6 +54,7 @@
background: transparent;
}
.ui-dialog-header {
+ white-space: nowrap;
border-bottom: 1px solid #E5E5E5;
}
.ui-dialog-close {
@@ -101,6 +105,7 @@
.ui-dialog-content {
display: inline-block;
position: relative;
+ vertical-align: middle;
*zoom: 1;
*display: inline;
text-align: left;
@@ -402,39 +407,39 @@
}
.ui-dialog-loading {
+ vertical-align: middle;
position: relative;
- display: inline-block;
+ display: block;
*zoom: 1;
*display: inline;
overflow: hidden;
width: 32px;
height: 32px;
- left: 50%;
top: 50%;
- margin-left: -16px;
- margin-top: -16px;
+ margin: -16px auto 0 auto;
font-size: 0;
- text-align: left;;
text-indent: -999em;
color: #666;
- position: inherit\9;
- margin: auto\9;
- width: auto\9;
- height: auto\9;
+}
+.ui-dialog-loading {
+ width: 100%\9;
text-indent: 0\9;
+ line-height: 32px\9;
+ text-align: center\9;
font-size: 12px\9;
}
.ui-dialog-loading::after {
+ position: absolute;
content: '';
width: 3px;
height: 3px;
margin: 14.5px 0 0 14.5px;
border-radius: 100%;
box-shadow: 0 -10px 0 1px #ccc, 10px 0px #ccc, 0 10px #ccc, -10px 0 #ccc, -7px -7px 0 0.5px #ccc, 7px -7px 0 1.5px #ccc, 7px 7px #ccc, -7px 7px #ccc;
- position: absolute;
-webkit-transform: rotate(360deg);
- -webkit-animation: ui-dialog-loading 1s infinite linear;
+ -webkit-animation: ui-dialog-loading 1.5s infinite linear;
transform: rotate(360deg);
- animation: ui-dialog-loading 1s infinite linear;
+ animation: ui-dialog-loading 1.5s infinite linear;
+ display: none\9;
}
diff --git a/doc/index.html b/doc/index.html
index 173ce8b..227a873 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -705,11 +705,23 @@
content(html)
示例
+传入字符串:
+
var d = dialog();
d.content('hello world');
d.show();
+传入元素节点:
+
+//..
+var elem = document.getElementById('test');
+dialog({
+ content: elem,
+ id: 'EF893L'
+}).show();
+
+
title(text)
写入对话框标题。
@@ -811,8 +823,9 @@ 示例
传入元素节点:
//..
+var elem = document.getElementById('test');
dialog({
- content: document.getElementById('test'),
+ content: elem,
id: 'EF893L'
}).show();
@@ -977,11 +990,6 @@ 选项
(默认值:false ) 是否自动聚焦 |
-width |
- String |
- (可选) 设置按钮 CSS width 值 |
-
-
disabled |
Boolean |
(默认值: false ) 是否禁用 |
diff --git a/doc/index.md b/doc/index.md
index 7284faf..0fd4fe3 100755
--- a/doc/index.md
+++ b/doc/index.md
@@ -374,11 +374,24 @@ d.close().remove();
#### 示例
+传入字符串:
+
```
var d = dialog();
d.content('hello world');
d.show();
-```
+```
+
+传入元素节点:
+
+```
+//..
+var elem = document.getElementById('test');
+dialog({
+ content: elem,
+ id: 'EF893L'
+}).show();
+```
### [title(text)](id:api-title)
@@ -485,8 +498,9 @@ dialog({
```
//..
+var elem = document.getElementById('test');
dialog({
- content: document.getElementById('test'),
+ content: elem,
id: 'EF893L'
}).show();
```
@@ -638,7 +652,6 @@ Array
value | String | 按钮显示文本
callback | Function | (可选) 回调函数``this``指向``dialog``对象,执行完毕默认关闭与销毁对话框(依次执行``close()``与``remove()``),若返回``false``则阻止关闭与销毁
autofocus | Boolean | (默认值:``false``) 是否自动聚焦
-width | String | (可选) 设置按钮 CSS width 值
disabled | Boolean | (默认值: ``false``) 是否禁用
id | String, Number | (可选) 按钮唯一标识
diff --git a/doc/js/doc.js b/doc/js/doc.js
index 551bd10..bd7390f 100644
--- a/doc/js/doc.js
+++ b/doc/js/doc.js
@@ -95,7 +95,7 @@ $(function () {
});
// 代码高亮
- setTimeout(sh_languages, 150);
+ setTimeout(sh_languages, 500);
// 回到顶部
var $top = $('TOP')
diff --git a/src/dialog.js b/src/dialog.js
index 81e9066..b5adbca 100644
--- a/src/dialog.js
+++ b/src/dialog.js
@@ -165,10 +165,10 @@ artDialog.create = function (options) {
// 按钮组点击
- $popup.on('click', '[data-trigger]', function (event) {
+ $popup.on('click', '[data-id]', function (event) {
var $this = $(this);
if (!$this.attr('disabled')) {// IE BUG
- that._trigger($this.data('trigger'));
+ that._trigger($this.data('id'));
}
event.preventDefault();
@@ -194,7 +194,7 @@ artDialog.create = function (options) {
// 避免输入状态中 ESC 误操作关闭
if (!isTop || rinput.test(nodeName) && target.type !== 'button') {
return;
- };
+ }
if (keyCode === 27) {
that._trigger('cancel');
@@ -315,7 +315,7 @@ $.extend(prototype, {
*/
content: function (html) {
- this._$('content').html('')
+ this._$('content').empty('')
[typeof html === 'object' ? 'append' : 'html'](html);
return this.reset();
@@ -370,8 +370,7 @@ $.extend(prototype, {
html +=
'