Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zui
提交
f26fb034
Z
zui
项目概览
易企天创
/
zui
11 个月 前同步成功
通知
6
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
37
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
37
Issue
37
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f26fb034
编写于
12月 15, 2014
作者:
C
Catouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* optimized js code.
上级
d989c63e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
11 deletion
+13
-11
src/js/modal.trigger.js
src/js/modal.trigger.js
+13
-11
未找到文件。
src/js/modal.trigger.js
浏览文件 @
f26fb034
...
...
@@ -11,7 +11,9 @@
if
(
!
$
.
fn
.
modal
)
throw
new
Error
(
'
Modal trigger requires modal.js
'
);
// ONCE MODAL CLASS DEFINITION
var
NAME
=
'
zui.modaltrigger
'
;
// MODAL TRIGGER CLASS DEFINITION
// ======================
var
ModalTrigger
=
function
(
options
)
{
...
...
@@ -89,7 +91,7 @@
if
(
!
that
.
isShown
)
$modal
.
off
(
'
.zui.modal
'
);
$modal
.
remove
();
}
$modal
=
$
(
'
<div id="
'
+
options
.
name
+
'
" class="modal modal-trigger"><div class="icon-spinner icon-spin loader"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button class="close" data-dismiss="modal">×</button><h4 class="modal-title"><i class="modal-icon"></i> <span class="modal-title-name"></span></h4></div><div class="modal-body"></div></div></div></div>
'
).
appendTo
(
'
body
'
).
data
(
'
zui.modaltrigger
'
,
that
);
$modal
=
$
(
'
<div id="
'
+
options
.
name
+
'
" class="modal modal-trigger"><div class="icon-spinner icon-spin loader"></div><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button class="close" data-dismiss="modal">×</button><h4 class="modal-title"><i class="modal-icon"></i> <span class="modal-title-name"></span></h4></div><div class="modal-body"></div></div></div></div>
'
).
appendTo
(
'
body
'
).
data
(
NAME
,
that
);
var
bindEvent
=
function
(
optonName
,
eventName
)
{
...
...
@@ -161,7 +163,7 @@
if
(
options
.
type
!=
'
iframe
'
)
{
$dialog
.
off
(
'
resize.
zui.modaltrigger
'
).
on
(
'
resize.zui.modaltrigger
'
,
function
()
$dialog
.
off
(
'
resize.
'
+
NAME
).
on
(
'
resize.
'
+
NAME
,
function
()
{
that
.
ajustPosition
();
});
...
...
@@ -252,7 +254,7 @@
setTimeout
(
ajustFrameSize
,
100
);
$framebody
.
off
(
'
resize.
zui.modaltrigger
'
).
on
(
'
resize.zui.modaltrigger
'
,
ajustFrameSize
);
$framebody
.
off
(
'
resize.
'
+
NAME
).
on
(
'
resize.
'
+
NAME
,
ajustFrameSize
);
}
frame$
.
extend
(
...
...
@@ -337,18 +339,18 @@
return
$
(
this
).
each
(
function
()
{
var
$this
=
$
(
this
);
var
data
=
$this
.
data
(
'
zui.modaltrigger
'
),
var
data
=
$this
.
data
(
NAME
),
options
=
$
.
extend
(
{
title
:
$this
.
attr
(
'
title
'
)
||
$this
.
text
(),
url
:
$this
.
attr
(
'
href
'
),
type
:
$this
.
hasClass
(
'
iframe
'
)
?
'
iframe
'
:
''
},
$this
.
data
(),
$
.
isPlainObject
(
option
)
&&
option
);
if
(
!
data
)
$this
.
data
(
'
zui.modaltrigger
'
,
(
data
=
new
ModalTrigger
(
options
)));
if
(
!
data
)
$this
.
data
(
NAME
,
(
data
=
new
ModalTrigger
(
options
)));
if
(
typeof
option
==
'
string
'
)
data
[
option
](
settings
);
else
if
(
options
.
show
)
data
.
show
(
settings
);
$this
.
on
((
options
.
trigger
||
'
click
'
)
+
'
.toggle.
zui.modaltrigger
'
,
function
(
e
)
$this
.
on
((
options
.
trigger
||
'
click
'
)
+
'
.toggle.
'
+
NAME
,
function
(
e
)
{
data
.
toggle
(
options
);
if
(
$this
.
is
(
'
a
'
))
e
.
preventDefault
();
...
...
@@ -389,7 +391,7 @@
{
modal
.
each
(
function
()
{
$
(
this
).
data
(
'
zui.modaltrigger
'
).
close
(
callback
,
redirect
);
$
(
this
).
data
(
NAME
).
close
(
callback
,
redirect
);
});
}
};
...
...
@@ -409,7 +411,7 @@
ajustModalPosition
:
window
.
ajustModalPosition
});
$
(
document
).
on
(
'
click.
zui.modaltrigger
.data-api
'
,
'
[data-toggle="modal"]
'
,
function
(
e
)
$
(
document
).
on
(
'
click.
'
+
NAME
+
'
.data-api
'
,
'
[data-toggle="modal"]
'
,
function
(
e
)
{
var
$this
=
$
(
this
);
var
href
=
$this
.
attr
(
'
href
'
);
...
...
@@ -422,7 +424,7 @@
{}
if
(
!
$target
||
!
$target
.
length
)
{
if
(
!
$this
.
data
(
'
zui.modaltrigger
'
))
if
(
!
$this
.
data
(
NAME
))
{
$this
.
modalTrigger
(
{
...
...
@@ -431,7 +433,7 @@
}
else
{
$this
.
trigger
(
'
.toggle.
zui.modaltrigger
'
);
$this
.
trigger
(
'
.toggle.
'
+
NAME
);
}
}
if
(
$this
.
is
(
'
a
'
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录