|
|
@ -255,7 +255,7 @@ doms.anim = {
|
|
|
|
doms.SHADE = 'layui-layer-shade';
|
|
|
|
doms.SHADE = 'layui-layer-shade';
|
|
|
|
doms.MOVE = 'layui-layer-move';
|
|
|
|
doms.MOVE = 'layui-layer-move';
|
|
|
|
|
|
|
|
|
|
|
|
//默认配置
|
|
|
|
// 默认配置
|
|
|
|
Class.pt.config = {
|
|
|
|
Class.pt.config = {
|
|
|
|
type: 0,
|
|
|
|
type: 0,
|
|
|
|
shade: 0.3,
|
|
|
|
shade: 0.3,
|
|
|
@ -265,16 +265,16 @@ Class.pt.config = {
|
|
|
|
offset: 'auto',
|
|
|
|
offset: 'auto',
|
|
|
|
area: 'auto',
|
|
|
|
area: 'auto',
|
|
|
|
closeBtn: 1,
|
|
|
|
closeBtn: 1,
|
|
|
|
time: 0, //0表示不自动关闭
|
|
|
|
icon: -1,
|
|
|
|
|
|
|
|
time: 0, // 0 表示不自动关闭
|
|
|
|
zIndex: 19891014,
|
|
|
|
zIndex: 19891014,
|
|
|
|
maxWidth: 360,
|
|
|
|
maxWidth: 360,
|
|
|
|
anim: 0,
|
|
|
|
anim: 0,
|
|
|
|
isOutAnim: true, //退出动画
|
|
|
|
isOutAnim: true, // 退出动画
|
|
|
|
minStack: true, //最小化堆叠
|
|
|
|
minStack: true, // 最小化堆叠
|
|
|
|
icon: -1,
|
|
|
|
|
|
|
|
moveType: 1,
|
|
|
|
moveType: 1,
|
|
|
|
resize: true,
|
|
|
|
resize: true,
|
|
|
|
scrollbar: true, //是否允许浏览器滚动条
|
|
|
|
scrollbar: true, // 是否允许浏览器滚动条
|
|
|
|
tips: 2
|
|
|
|
tips: 2
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -382,25 +382,45 @@ Class.pt.vessel = function(conType, callback){
|
|
|
|
return that;
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//创建骨架
|
|
|
|
// 创建骨架
|
|
|
|
Class.pt.creat = function(){
|
|
|
|
Class.pt.creat = function(){
|
|
|
|
var that = this
|
|
|
|
var that = this;
|
|
|
|
,config = that.config
|
|
|
|
var config = that.config;
|
|
|
|
,times = that.index, nodeIndex
|
|
|
|
var times = that.index, nodeIndex;
|
|
|
|
,content = config.content
|
|
|
|
var content = config.content;
|
|
|
|
,conType = typeof content === 'object'
|
|
|
|
var conType = typeof content === 'object';
|
|
|
|
,body = $('body');
|
|
|
|
var body = $('body');
|
|
|
|
|
|
|
|
|
|
|
|
if(config.id && $('.'+ doms[0]).find('#'+ config.id)[0]) return;
|
|
|
|
// 若 id 对应的弹层已经存在,则不重新创建
|
|
|
|
|
|
|
|
if(config.id && $('.'+ doms[0]).find('#'+ config.id)[0]){
|
|
|
|
|
|
|
|
return (function(){
|
|
|
|
|
|
|
|
var layero = $('#'+ config.id).closest('.'+ doms[0]);
|
|
|
|
|
|
|
|
var index = layero.attr('times');
|
|
|
|
|
|
|
|
var options = layero.data('config');
|
|
|
|
|
|
|
|
var elemShade = $('#'+ doms.SHADE + index);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var maxminStatus = layero.data('maxminStatus') || {};
|
|
|
|
|
|
|
|
// 若弹层为最小化状态,则点击目标元素时,自动还原
|
|
|
|
|
|
|
|
if(maxminStatus === 'min'){
|
|
|
|
|
|
|
|
layer.restore(index);
|
|
|
|
|
|
|
|
} else if(options.hideOnClose){
|
|
|
|
|
|
|
|
elemShade.show();
|
|
|
|
|
|
|
|
layero.show();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 是否移除活动元素的焦点
|
|
|
|
if(config.removeFocus) {
|
|
|
|
if(config.removeFocus) {
|
|
|
|
document.activeElement.blur(); // 将原始的聚焦节点失焦
|
|
|
|
document.activeElement.blur(); // 将原始的聚焦节点失焦
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化 area 属性
|
|
|
|
if(typeof config.area === 'string'){
|
|
|
|
if(typeof config.area === 'string'){
|
|
|
|
config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
|
|
|
|
config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//anim兼容旧版shift
|
|
|
|
// anim 兼容旧版 shift
|
|
|
|
if(config.shift){
|
|
|
|
if(config.shift){
|
|
|
|
config.anim = config.shift;
|
|
|
|
config.anim = config.shift;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1153,6 +1173,9 @@ layer.close = function(index, callback){
|
|
|
|
}();
|
|
|
|
}();
|
|
|
|
var type = layero.attr('type');
|
|
|
|
var type = layero.attr('type');
|
|
|
|
var options = layero.data('config') || {};
|
|
|
|
var options = layero.data('config') || {};
|
|
|
|
|
|
|
|
var hideOnClose = options.id && options.hideOnClose; // 是否关闭时移除弹层容器
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!layero[0]) return;
|
|
|
|
|
|
|
|
|
|
|
|
// 关闭动画
|
|
|
|
// 关闭动画
|
|
|
|
var closeAnim = ({
|
|
|
|
var closeAnim = ({
|
|
|
@ -1161,10 +1184,18 @@ layer.close = function(index, callback){
|
|
|
|
slideUp: 'layer-anim-slide-up-out',
|
|
|
|
slideUp: 'layer-anim-slide-up-out',
|
|
|
|
slideRight: 'layer-anim-slide-right-out'
|
|
|
|
slideRight: 'layer-anim-slide-right-out'
|
|
|
|
})[options.anim] || 'layer-anim-close';
|
|
|
|
})[options.anim] || 'layer-anim-close';
|
|
|
|
|
|
|
|
|
|
|
|
if(!layero[0]) return;
|
|
|
|
// 移除主容器
|
|
|
|
|
|
|
|
var remove = function(){
|
|
|
|
var WRAP = 'layui-layer-wrap', remove = function(){
|
|
|
|
var WRAP = 'layui-layer-wrap';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 是否关闭时隐藏弹层容器
|
|
|
|
|
|
|
|
if(hideOnClose){
|
|
|
|
|
|
|
|
layero.removeClass('layer-anim '+ closeAnim);
|
|
|
|
|
|
|
|
return layero.hide();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 是否为页面捕获层
|
|
|
|
if(type === ready.type[1] && layero.attr('conType') === 'object'){
|
|
|
|
if(type === ready.type[1] && layero.attr('conType') === 'object'){
|
|
|
|
layero.children(':not(.'+ doms[5] +')').remove();
|
|
|
|
layero.children(':not(.'+ doms[5] +')').remove();
|
|
|
|
var wrap = layero.find('.'+WRAP);
|
|
|
|
var wrap = layero.find('.'+WRAP);
|
|
|
@ -1173,7 +1204,7 @@ layer.close = function(index, callback){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wrap.css('display', wrap.data('display')).removeClass(WRAP);
|
|
|
|
wrap.css('display', wrap.data('display')).removeClass(WRAP);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//低版本IE 回收 iframe
|
|
|
|
// 低版本 IE 回收 iframe
|
|
|
|
if(type === ready.type[2]){
|
|
|
|
if(type === ready.type[2]){
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
var iframe = $('#'+ doms[4] + index)[0];
|
|
|
|
var iframe = $('#'+ doms[4] + index)[0];
|
|
|
@ -1196,13 +1227,18 @@ layer.close = function(index, callback){
|
|
|
|
delete ready.events.resize[index];
|
|
|
|
delete ready.events.resize[index];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// 移除遮罩
|
|
|
|
|
|
|
|
var removeShade = (function fn(){
|
|
|
|
|
|
|
|
$('#'+ doms.SHADE + index)[
|
|
|
|
|
|
|
|
hideOnClose ? 'hide' : 'remove'
|
|
|
|
|
|
|
|
]();
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
// 是否允许关闭动画
|
|
|
|
// 是否允许关闭动画
|
|
|
|
if(options.isOutAnim){
|
|
|
|
if(options.isOutAnim){
|
|
|
|
layero.addClass('layer-anim '+ closeAnim);
|
|
|
|
layero.addClass('layer-anim '+ closeAnim);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$('#layui-layer-moves, #'+ doms.SHADE + index).remove();
|
|
|
|
|
|
|
|
layer.ie == 6 && ready.reselect();
|
|
|
|
layer.ie == 6 && ready.reselect();
|
|
|
|
ready.rescollbar(index);
|
|
|
|
ready.rescollbar(index);
|
|
|
|
|
|
|
|
|
|
|
|