Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zui
提交
d4fbc60d
Z
zui
项目概览
易企天创
/
zui
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
d4fbc60d
编写于
7月 03, 2018
作者:
C
Catouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* add scrollInside option to modal trigger.
上级
4678d572
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
15 deletion
+37
-15
src/js/modal.trigger.js
src/js/modal.trigger.js
+29
-14
src/less/modules/modals.less
src/less/modules/modals.less
+8
-1
未找到文件。
src/js/modal.trigger.js
浏览文件 @
d4fbc60d
...
...
@@ -45,7 +45,8 @@
backdrop
:
true
,
keyboard
:
true
,
waittime
:
0
,
loadingIcon
:
'
icon-spinner-indicator
'
loadingIcon
:
'
icon-spinner-indicator
'
,
scrollInside
:
false
};
ModalTrigger
.
prototype
.
init
=
function
(
options
)
{
...
...
@@ -107,7 +108,9 @@
};
ModalTrigger
.
prototype
.
show
=
function
(
option
)
{
var
options
=
$
.
extend
({},
this
.
options
,
{
url
:
this
.
$trigger
?
(
this
.
$trigger
.
attr
(
'
href
'
)
||
this
.
$trigger
.
attr
(
'
data-url
'
)
||
this
.
$trigger
.
data
(
'
url
'
))
:
this
.
options
.
url
},
option
);
var
options
=
$
.
extend
({},
this
.
options
,
{
url
:
this
.
$trigger
?
(
this
.
$trigger
.
attr
(
'
href
'
)
||
this
.
$trigger
.
attr
(
'
data-url
'
)
||
this
.
$trigger
.
data
(
'
url
'
))
:
this
.
options
.
url
},
option
);
this
.
init
(
options
);
var
that
=
this
,
...
...
@@ -120,7 +123,8 @@
$modal
.
toggleClass
(
'
fade
'
,
options
.
fade
)
.
addClass
(
options
.
className
)
.
toggleClass
(
'
modal-loading
'
,
!
this
.
isShown
);
.
toggleClass
(
'
modal-loading
'
,
!
this
.
isShown
)
.
toggleClass
(
'
modal-scroll-inside
'
,
!!
options
.
scrollInside
);
$dialog
.
toggleClass
(
'
modal-md
'
,
options
.
size
===
'
md
'
)
.
toggleClass
(
'
modal-sm
'
,
options
.
size
===
'
sm
'
)
...
...
@@ -209,6 +213,7 @@
var
frame
=
document
.
getElementById
(
iframeName
);
frame
.
onload
=
frame
.
onreadystatechange
=
function
()
{
var
scrollInside
=
!!
options
.
scrollInside
;
if
(
that
.
firstLoad
)
$modal
.
addClass
(
'
modal-loading
'
);
if
(
this
.
readyState
&&
this
.
readyState
!=
'
complete
'
)
return
;
that
.
firstLoad
=
false
;
...
...
@@ -216,22 +221,26 @@
if
(
options
.
waittime
>
0
)
{
clearTimeout
(
that
.
waitTimeout
);
}
try
{
$modal
.
attr
(
'
ref
'
,
frame
.
contentWindow
.
location
.
href
);
var
frame$
=
window
.
frames
[
iframeName
].
$
;
if
(
frame$
&&
options
.
height
===
'
auto
'
&&
options
.
size
!=
'
fullscreen
'
)
{
// todo: update iframe url to ref attribute
var
$framebody
=
frame$
(
'
body
'
).
addClass
(
'
body-modal
'
);
var
$framebody
=
frame$
(
'
body
'
).
addClass
(
'
body-modal
'
).
toggleClass
(
'
body-modal-scroll-inside
'
,
scrollInside
);
if
(
options
.
iframeBodyClass
)
$framebody
.
addClass
(
options
.
iframeBodyClass
);
var
ajustFrameSize
=
function
(
check
)
{
$modal
.
removeClass
(
'
fade
'
);
console
.
log
(
'
$framebody.outerHeight()
'
,
$framebody
.
outerHeight
());
var
height
=
$framebody
.
outerHeight
();
if
(
check
===
true
&&
options
.
onlyIncreaseHeight
)
{
height
=
Math
.
max
(
height
,
$body
.
data
(
'
minModalHeight
'
)
||
0
);
$body
.
data
(
'
minModalHeight
'
,
height
);
}
if
(
scrollInside
)
{
var
winHeight
=
$
(
window
).
height
();
height
=
Math
.
min
(
height
,
winHeight
-
$header
.
height
());
}
$body
.
css
(
'
height
'
,
height
);
if
(
options
.
fade
)
$modal
.
addClass
(
'
fade
'
);
readyToShow
();
...
...
@@ -244,7 +253,10 @@
setTimeout
(
ajustFrameSize
,
100
);
$framebody
.
off
(
'
resize.
'
+
NAME
).
on
(
'
resize.
'
+
NAME
,
resizeDialog
);
$framebody
.
off
(
'
resize.
'
+
NAME
).
on
(
'
resize.
'
+
NAME
,
ajustFrameSize
);
if
(
scrollInside
)
{
$
(
window
).
off
(
'
resize.
'
+
NAME
).
on
(
'
resize.
'
+
NAME
,
ajustFrameSize
);
}
}
else
{
readyToShow
();
}
...
...
@@ -291,17 +303,18 @@
};
ModalTrigger
.
prototype
.
close
=
function
(
callback
,
redirect
)
{
var
that
=
this
;
if
(
callback
||
redirect
)
{
th
is
.
$modal
.
on
(
'
hidden
'
+
ZUI_MODAL
,
function
()
{
th
at
.
$modal
.
on
(
'
hidden
'
+
ZUI_MODAL
,
function
()
{
if
(
$
.
isFunction
(
callback
))
callback
();
if
(
typeof
redirect
===
STR_STRING
)
{
if
(
typeof
redirect
===
STR_STRING
&&
redirect
.
length
&&
!
that
.
$modal
.
data
(
'
cancel-reload
'
)
)
{
if
(
redirect
===
'
this
'
)
window
.
location
.
reload
();
else
window
.
location
=
redirect
;
}
});
}
th
is
.
$modal
.
modal
(
'
hide
'
);
th
at
.
$modal
.
modal
(
'
hide
'
);
};
ModalTrigger
.
prototype
.
toggle
=
function
(
options
)
{
...
...
@@ -336,6 +349,9 @@
else
if
(
options
.
show
)
data
.
show
(
settings
);
$this
.
on
((
options
.
trigger
||
'
click
'
)
+
'
.toggle.
'
+
NAME
,
function
(
e
)
{
options
=
$
.
extend
(
options
,
{
url
:
$this
.
attr
(
'
href
'
)
||
$this
.
attr
(
'
data-url
'
)
||
$this
.
data
(
'
url
'
)
||
options
.
url
});
data
.
toggle
(
options
);
if
(
$this
.
is
(
'
a
'
))
e
.
preventDefault
();
});
...
...
@@ -352,10 +368,9 @@
};
var
getModal
=
function
(
modal
)
{
var
modalType
=
typeof
(
modal
);
if
(
modalType
===
'
undefined
'
)
{
if
(
!
modal
)
{
modal
=
$
(
'
.modal.modal-trigger
'
);
}
else
if
(
modalType
===
STR_STRING
)
{
}
else
{
modal
=
$
(
modal
);
}
if
(
modal
&&
(
modal
instanceof
$
))
return
modal
;
...
...
@@ -376,7 +391,7 @@
modal
.
each
(
function
()
{
$
(
this
).
data
(
NAME
).
close
(
callback
,
redirect
);
});
}
else
{
}
else
if
(
!
$
(
'
body
'
).
hasClass
(
'
modal-open
'
)
&&
!
$
(
'
.modal.in
'
).
length
)
{
// check if current page is as modal iframe
if
(
$
(
'
body
'
).
hasClass
(
'
body-modal
'
))
{
window
.
parent
.
$
.
zui
.
closeModal
(
originModal
,
callback
,
redirect
);
...
...
src/less/modules/modals.less
浏览文件 @
d4fbc60d
...
...
@@ -32,7 +32,6 @@
left: 0;
z-index: @zindex-modal;
-webkit-overflow-scrolling: touch;
pointer-events: none;
// Prevent Chrome on Windows from adding a focus outline. For details, see
// https://github.com/twbs/bootstrap/pull/10951.
...
...
@@ -216,3 +215,11 @@
overflow-y: auto;
}
}
.modal-scroll-inside {
.modal-dialog {margin: 0 auto;}
}
.body-modal-scroll-inside {
overflow: auto;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录