1.91
53
src/layer.js
|
@ -1,6 +1,6 @@
|
|||
/*!
|
||||
|
||||
@Name:layer v1.9.0 弹层组件
|
||||
@Name:layer v1.9.1 弹层组件
|
||||
@Author:贤心
|
||||
@Site:http://sentsin.com/jquery/layer
|
||||
@License:LGPL
|
||||
|
@ -12,7 +12,8 @@
|
|||
|
||||
var $, win, ready = {
|
||||
getPath: function(){
|
||||
var js = document.scripts, jsPath = js[js.length - 1].src;
|
||||
var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
|
||||
if(script.getAttribute('merge')) return;
|
||||
return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);
|
||||
}(),
|
||||
config: {}, end: {},
|
||||
|
@ -24,7 +25,7 @@ var $, win, ready = {
|
|||
|
||||
//默认内置方法。
|
||||
window.layer = {
|
||||
v: '1.9.0',
|
||||
v: '1.9.1',
|
||||
ie6: !!window.ActiveXObject&&!window.XMLHttpRequest,
|
||||
index: 0,
|
||||
path: ready.getPath,
|
||||
|
@ -51,6 +52,7 @@ window.layer = {
|
|||
var iscss = /\.css$/.test(module);
|
||||
var node = document.createElement(iscss ? 'link' : 'script');
|
||||
var id = 'layui_layer_' + module.replace(/\.|\//g, '');
|
||||
if(!layer.path) return;
|
||||
if(iscss){
|
||||
node.rel = 'stylesheet';
|
||||
}
|
||||
|
@ -149,7 +151,7 @@ window.layer = {
|
|||
var Class = function(setings){
|
||||
var that = this;
|
||||
that.index = ++layer.index;
|
||||
that.config = $.extend({}, that.config, setings, ready.config);
|
||||
that.config = $.extend({}, that.config, ready.config, setings);
|
||||
that.creat();
|
||||
};
|
||||
|
||||
|
@ -182,7 +184,7 @@ Class.pt.config = {
|
|||
Class.pt.vessel = function(conType, callback){
|
||||
var that = this, times = that.index, config = that.config;
|
||||
var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
|
||||
var ismax = config.maxmin && (config.type === 1 || config.type === 2) && (!/^\d+%$/.test(config.area[0]) || !/^\d+%$/.test(config.area[1]));
|
||||
var ismax = config.maxmin && (config.type === 1 || config.type === 2);
|
||||
var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
|
||||
+ (titype ? config.title[0] : config.title)
|
||||
+ '</div>' : '');
|
||||
|
@ -332,7 +334,7 @@ Class.pt.offset = function(){
|
|||
that.offsetLeft = (win.width() - area[0])/2;
|
||||
if(type){
|
||||
that.offsetTop = config.offset[0];
|
||||
that.offsetLeft = config.offset[1];
|
||||
that.offsetLeft = config.offset[1]||that.offsetLeft;
|
||||
} else if(config.offset !== 'auto'){
|
||||
that.offsetTop = config.offset;
|
||||
if(config.offset === 'rb'){ //右下角
|
||||
|
@ -341,6 +343,12 @@ Class.pt.offset = function(){
|
|||
}
|
||||
}
|
||||
if(!config.fix){
|
||||
that.offsetTop = /%$/.test(that.offsetTop) ?
|
||||
win.height()*parseFloat(that.offsetTop)/100
|
||||
: parseFloat(that.offsetTop);
|
||||
that.offsetLeft = /%$/.test(that.offsetLeft) ?
|
||||
win.width()*parseFloat(that.offsetLeft)/100
|
||||
: parseFloat(that.offsetLeft);
|
||||
that.offsetTop += win.scrollTop();
|
||||
that.offsetLeft += win.scrollLeft();
|
||||
}
|
||||
|
@ -497,16 +505,26 @@ Class.pt.callback = function(){
|
|||
}
|
||||
layer.ie6 && that.IE6(layero);
|
||||
|
||||
//确认
|
||||
layero.find('.'+ doms[6] +'0').on('click',function(){
|
||||
config.yes ? config.yes(that.index) : layer.close(that.index);
|
||||
//按钮
|
||||
layero.find('.'+ doms[6]).children('a').on('click', function(){
|
||||
var index = $(this).index();
|
||||
if(index === 0){
|
||||
config.yes ? config.yes(that.index, layero) : layer.close(that.index);
|
||||
} else if(index === 1){
|
||||
cancel();
|
||||
} else {
|
||||
config['btn'+(index+1)] ? config['btn'+(index+1)](that.index, layero) : layer.close(that.index);
|
||||
}
|
||||
});
|
||||
|
||||
//取消
|
||||
layero.find('.'+ doms[7] +',.'+ doms[6] +'1').on('click', function(){
|
||||
config.cancel && config.cancel(that.index);
|
||||
layer.close(that.index);
|
||||
});
|
||||
function cancel(){
|
||||
var close = config.cancel && config.cancel(that.index);
|
||||
close === false || layer.close(that.index);
|
||||
}
|
||||
|
||||
//右上角关闭回调
|
||||
layero.find('.'+ doms[7]).on('click', cancel);
|
||||
|
||||
//点遮罩关闭
|
||||
if(config.shadeClose){
|
||||
|
@ -654,7 +672,7 @@ layer.min = function(index, options){
|
|||
var layero = $('#'+ doms[0] + index);
|
||||
var titHeight = layero.find(doms[1]).outerHeight() || 0;
|
||||
ready.record(layero);
|
||||
layer.style(index, {width: 180, height: titHeight});
|
||||
layer.style(index, {width: 180, height: titHeight, overflow: 'hidden'});
|
||||
layero.find('.layui-layer-min').hide();
|
||||
layero.attr('type') === 'page' && layero.find(doms[4]).hide();
|
||||
ready.rescollbar(index);
|
||||
|
@ -668,7 +686,8 @@ layer.restore = function(index){
|
|||
width: parseFloat(area[0]),
|
||||
height: parseFloat(area[1]),
|
||||
top: parseFloat(area[2]),
|
||||
left: parseFloat(area[3])
|
||||
left: parseFloat(area[3]),
|
||||
overflow: 'visible'
|
||||
});
|
||||
layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
|
||||
layero.find('.layui-layer-min').show();
|
||||
|
@ -736,9 +755,7 @@ layer.closeAll = function(type){
|
|||
$.each($('.'+doms[0]), function(){
|
||||
var othis = $(this);
|
||||
var is = type ? (othis.attr('type') === type) : 1;
|
||||
if(is){
|
||||
layer.close(othis.attr('times'));
|
||||
}
|
||||
is && layer.close(othis.attr('times'));
|
||||
is = null;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -57,8 +57,8 @@ html #layui_layer_skinlayercss{display:none; position: absolute; width:1989px;}
|
|||
|
||||
/* 按钮栏 */
|
||||
.layui-layer-btn{text-align:center; padding:10px 30px; pointer-events: auto;}
|
||||
.layui-layer-btn a{height:30px; line-height:30px; margin:0 8px; padding:0 20px; background:#5FBFE7; color:#fff; font-size:14px; font-weight:bold; cursor:pointer;}
|
||||
.layui-layer-btn a:hover{opacity:0.9;}
|
||||
.layui-layer-btn a{height:30px; line-height:30px; margin:0 8px; padding:0 20px; background:#5FBFE7; color:#fff; font-size:14px; font-weight:bold; cursor:pointer; text-decoration: none;}
|
||||
.layui-layer-btn a:hover{opacity:0.9; text-decoration: none;}
|
||||
.layui-layer-btn a:active{opacity:0.7;}
|
||||
.layui-layer-btn .layui-layer-btn1{background:#A6BBCE;}
|
||||
|
||||
|
@ -112,8 +112,8 @@ html #layui_layer_skinlayercss{display:none; position: absolute; width:1989px;}
|
|||
.layui-layer-lan .layui-layer-btn{border-top:1px solid #E9E7E7}
|
||||
.layui-layer-lan .layui-layer-btn a{background:#BBB5B5;}
|
||||
.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5;}
|
||||
.layui-layer-molv .layui-layer-title{background:#60B979; color:#fff; border: none;}
|
||||
.layui-layer-molv .layui-layer-btn a{background:#659D94;}
|
||||
.layui-layer-molv .layui-layer-title{background:#009f95; color:#fff; border: none;}
|
||||
.layui-layer-molv .layui-layer-btn a{background:#009f95;}
|
||||
.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1;}
|
||||
|
||||
|
||||
|
|
Before Width: | Height: | Size: 873 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 923 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.4 KiB |
|
@ -31,6 +31,6 @@ body .layer-ext-seaning .layui-layer-ico11{background:url(default.png) no-repeat
|
|||
body .layer-ext-seaning .layui-layer-ico12{background:url(default.png) no-repeat -576px 0;}
|
||||
body .layer-ext-seaning .layui-layer-ico13{background:url(default.png) no-repeat -624px 0;}
|
||||
body .layer-ext-seaning .layui-layer-setwin .layui-layer-close1 {width: 14px; height: 14px; background:url(close.png) no-repeat;}
|
||||
body .layer-ext-seaning .layui-layer-content{border-bottom:1px #e9e9e9 solid;padding:30px;}
|
||||
body .layer-ext-seaning .layui-layer-padding{padding-top:28px;padding-left:74px;}
|
||||
body .layer-ext-seaning .layui-layer-btn{border-top:1px #e9e9e9 solid;}
|
||||
body .layer-ext-seaning .layui-layer-padding{padding-top:28px;padding-left:74px;padding-bottom: 30px;}
|
||||
body .layer-ext-seaning .layui-layer-btn{padding:5px 0;text-align:right;}
|