mirror of https://github.com/layui/layer
1.8.5
parent
2ec5ca38e5
commit
b523c15f5f
|
@ -1,13 +1,13 @@
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@Name: layer拓展类,依赖于layer
|
@Name: layer拓展类,依赖于layer
|
||||||
@Date: 2014.07.04
|
@Date: 2014.08.13
|
||||||
@Author: 贤心
|
@Author: 贤心
|
||||||
@Versions:1.8.4-ext
|
@Versions:1.8.5-ext
|
||||||
@Api:http://sentsin.com/jquery/layer
|
@Api:http://sentsin.com/jquery/layer
|
||||||
@Desc: 本拓展会持续更新
|
@Desc: 本拓展会持续更新
|
||||||
|
|
||||||
**/
|
*/
|
||||||
|
|
||||||
layer.use('skin/layer.ext.css', function(){
|
layer.use('skin/layer.ext.css', function(){
|
||||||
layer.ext && layer.ext();
|
layer.ext && layer.ext();
|
||||||
|
@ -17,9 +17,8 @@ layer.use('skin/layer.ext.css', function(){
|
||||||
/**
|
/**
|
||||||
|
|
||||||
系统prompt
|
系统prompt
|
||||||
By 贤心
|
|
||||||
|
|
||||||
**/
|
*/
|
||||||
|
|
||||||
layer.prompt = function(parme, yes, no){
|
layer.prompt = function(parme, yes, no){
|
||||||
var log = {}, parme = parme || {}, conf = {
|
var log = {}, parme = parme || {}, conf = {
|
||||||
|
@ -51,10 +50,11 @@ layer.prompt = function(parme, yes, no){
|
||||||
}, no: no
|
}, no: no
|
||||||
}, success: function(){
|
}, success: function(){
|
||||||
log.prompt = $('#xubox_prompt');
|
log.prompt = $('#xubox_prompt');
|
||||||
|
log.prompt.focus();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if(parme.type === 3){
|
if(parme.type === 3){
|
||||||
conf.dialog.msg = '<textarea class="xubox_prompt xubox_form xubox_formArea" id="xubox_prompt"></textarea>'
|
conf.dialog.msg = '<textarea class="xubox_prompt xubox_form xubox_formArea" id="xubox_prompt">'+ (parme.val || '') +'</textarea>'
|
||||||
}
|
}
|
||||||
return $.layer(conf);
|
return $.layer(conf);
|
||||||
};
|
};
|
||||||
|
@ -63,9 +63,8 @@ layer.prompt = function(parme, yes, no){
|
||||||
/**
|
/**
|
||||||
|
|
||||||
tab层
|
tab层
|
||||||
By 贤心
|
|
||||||
|
|
||||||
**/
|
*/
|
||||||
|
|
||||||
layer.tab = function(parme){
|
layer.tab = function(parme){
|
||||||
var log = {}, parme = parme || {}, data = parme.data || [], conf = {
|
var log = {}, parme = parme || {}, data = parme.data || [], conf = {
|
||||||
|
@ -128,9 +127,8 @@ layer.tab = function(parme){
|
||||||
/**
|
/**
|
||||||
|
|
||||||
相册层
|
相册层
|
||||||
By 贤心
|
|
||||||
|
|
||||||
**/
|
*/
|
||||||
|
|
||||||
|
|
||||||
layer.photos = function(options){
|
layer.photos = function(options){
|
||||||
|
|
52
layer.js
52
layer.js
|
@ -1,15 +1,13 @@
|
||||||
/**************************************************************
|
/****************************************
|
||||||
|
|
||||||
@Name:layer v1.8.4 弹层组件开发版
|
@Name:layer v1.8.5 弹层组件开发版
|
||||||
@Author:贤心
|
@Author:贤心
|
||||||
@Date:2014-07-07
|
@Date:2014-08-13
|
||||||
@Blog:http://sentsin.com
|
@Blog:http://sentsin.com
|
||||||
@QQ群:78803422 (layer组件群3)
|
|
||||||
@Copyright:Sentsin Xu(贤心)
|
@Copyright:Sentsin Xu(贤心)
|
||||||
@官网:http://sentsin.com/jquery/layer
|
@官网:http://sentsin.com/jquery/layer
|
||||||
@授权:http://url.cn/RAejZY
|
|
||||||
|
|
||||||
*************************************************************/
|
*/
|
||||||
|
|
||||||
;!function(window, undefined){
|
;!function(window, undefined){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
@ -29,7 +27,7 @@ $, win, ready = {
|
||||||
|
|
||||||
//默认内置方法。
|
//默认内置方法。
|
||||||
window.layer = {
|
window.layer = {
|
||||||
v: '1.8.4',
|
v: '1.8.5',
|
||||||
ie6: !-[1,] && !window.XMLHttpRequest,
|
ie6: !-[1,] && !window.XMLHttpRequest,
|
||||||
index: 0,
|
index: 0,
|
||||||
path: ready.getPath(),
|
path: ready.getPath(),
|
||||||
|
@ -160,7 +158,7 @@ Class.pt.config = {
|
||||||
shade: [0.3, '#000'],
|
shade: [0.3, '#000'],
|
||||||
fix: true,
|
fix: true,
|
||||||
move: '.xubox_title',
|
move: '.xubox_title',
|
||||||
title: ['信息', true],
|
title: '信息',
|
||||||
offset: ['', '50%'],
|
offset: ['', '50%'],
|
||||||
area: ['310px', 'auto'],
|
area: ['310px', 'auto'],
|
||||||
closeBtn: [0, true],
|
closeBtn: [0, true],
|
||||||
|
@ -202,8 +200,8 @@ Class.pt.space = function(html){
|
||||||
closebtn = '<a class="xubox_min" href="javascript:;"><cite></cite></a><a class="xubox_max xulayer_png32" href="javascript:;"></a>';
|
closebtn = '<a class="xubox_min" href="javascript:;"><cite></cite></a><a class="xubox_max xulayer_png32" href="javascript:;"></a>';
|
||||||
}
|
}
|
||||||
config.closeBtn[1] && (closebtn += '<a class="xubox_close xulayer_png32 xubox_close' + config.closeBtn[0] +'" href="javascript:;" style="'+ (config.type === 4 ? 'position:absolute; right:-3px; _right:7px; top:-4px;' : '') +'"></a>');
|
config.closeBtn[1] && (closebtn += '<a class="xubox_close xulayer_png32 xubox_close' + config.closeBtn[0] +'" href="javascript:;" style="'+ (config.type === 4 ? 'position:absolute; right:-3px; _right:7px; top:-4px;' : '') +'"></a>');
|
||||||
|
var titype = typeof config.title === 'object';
|
||||||
config.title[1] && (title = '<div class="xubox_title"><em>' + config.title[0] + '</em></div>');
|
config.title && (title = '<div class="xubox_title" style="'+ (titype ? config.title[1] : '') +'"><em>' + (titype ? config.title[0] : config.title) + '</em></div>');
|
||||||
return [shade,
|
return [shade,
|
||||||
'<div times="'+ times +'" showtime="'+ config.time +'" style="z-index:'+ zIndex +'" id="'+ doms[0] +''+ times
|
'<div times="'+ times +'" showtime="'+ config.time +'" style="z-index:'+ zIndex +'" id="'+ doms[0] +''+ times
|
||||||
+'" class="'+ doms[0] +'">'
|
+'" class="'+ doms[0] +'">'
|
||||||
|
@ -224,14 +222,10 @@ Class.pt.creat = function(){
|
||||||
space = that.space(html);
|
space = that.space(html);
|
||||||
body.append($(space[0]));
|
body.append($(space[0]));
|
||||||
};
|
};
|
||||||
if(config.title === false){
|
|
||||||
config.title = [];
|
|
||||||
} else if(typeof config.title === 'string') {
|
|
||||||
config.title = [config.title, true]
|
|
||||||
}
|
|
||||||
switch(config.type){
|
switch(config.type){
|
||||||
case 0:
|
case 0:
|
||||||
config.title[1] || (config.area = ['auto','auto']);
|
config.title || (config.area = ['auto','auto']);
|
||||||
$('.xubox_dialog')[0] && layer.close($('.xubox_dialog').parents('.'+ doms[0]).attr('times'));
|
$('.xubox_dialog')[0] && layer.close($('.xubox_dialog').parents('.'+ doms[0]).attr('times'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -257,14 +251,14 @@ Class.pt.creat = function(){
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
config.title = [];
|
config.title = false;
|
||||||
config.area = ['auto', 'auto'];
|
config.area = ['auto', 'auto'];
|
||||||
config.closeBtn = ['', false];
|
config.closeBtn = ['', false];
|
||||||
$('.xubox_loading')[0] && layer.closeLoad();
|
$('.xubox_loading')[0] && layer.closeLoad();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
config.title = [];
|
config.title = false;
|
||||||
config.area = ['auto', 'auto'];
|
config.area = ['auto', 'auto'];
|
||||||
config.fix = false;
|
config.fix = false;
|
||||||
config.border = [0];
|
config.border = [0];
|
||||||
|
@ -282,7 +276,7 @@ Class.pt.creat = function(){
|
||||||
config.fix || layerE.css({position: 'absolute'});
|
config.fix || layerE.css({position: 'absolute'});
|
||||||
|
|
||||||
//配置按钮
|
//配置按钮
|
||||||
if(config.title[1] && (config.type !== 3 || config.type !== 4)){
|
if(config.title && (config.type !== 3 || config.type !== 4)){
|
||||||
var confbtn = config.type === 0 ? dialog : config, layerBtn = layerE.find('.xubox_botton');
|
var confbtn = config.type === 0 ? dialog : config, layerBtn = layerE.find('.xubox_botton');
|
||||||
confbtn.btn = config.btn || dialog.btn;
|
confbtn.btn = config.btn || dialog.btn;
|
||||||
switch(confbtn.btns){
|
switch(confbtn.btns){
|
||||||
|
@ -350,7 +344,7 @@ Class.pt.set = function(times){
|
||||||
|
|
||||||
that.autoArea(times);
|
that.autoArea(times);
|
||||||
|
|
||||||
if(config.title[1]){
|
if(config.title){
|
||||||
if(config.type === 0){
|
if(config.type === 0){
|
||||||
layer.ie6 && layerTitle.css({width : layerE.outerWidth()});
|
layer.ie6 && layerTitle.css({width : layerE.outerWidth()});
|
||||||
}
|
}
|
||||||
|
@ -377,7 +371,7 @@ Class.pt.set = function(times){
|
||||||
switch(config.type){
|
switch(config.type){
|
||||||
case 0:
|
case 0:
|
||||||
layerE.find(doms[5]).css({'background-color': '#fff'});
|
layerE.find(doms[5]).css({'background-color': '#fff'});
|
||||||
if(config.title[1]){
|
if(config.title){
|
||||||
layerE.find(doms[3]).css({paddingTop: 18 + layerTitle.outerHeight()});
|
layerE.find(doms[3]).css({paddingTop: 18 + layerTitle.outerHeight()});
|
||||||
}else{
|
}else{
|
||||||
layerE.find('.xubox_msgico').css({top: 8});
|
layerE.find('.xubox_msgico').css({top: 8});
|
||||||
|
@ -388,13 +382,13 @@ Class.pt.set = function(times){
|
||||||
case 1:
|
case 1:
|
||||||
layerE.find(page.dom).addClass('layer_pageContent');
|
layerE.find(page.dom).addClass('layer_pageContent');
|
||||||
config.shade[0] && layerE.css({zIndex: config.zIndex + 1});
|
config.shade[0] && layerE.css({zIndex: config.zIndex + 1});
|
||||||
config.title[1] && layerE.find(doms[4]).css({top: layerTitle.outerHeight()});
|
config.title && layerE.find(doms[4]).css({top: layerTitle.outerHeight()});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
var iframe = layerE.find('.'+ doms[1]), heg = layerE.height();
|
var iframe = layerE.find('.'+ doms[1]), heg = layerE.height();
|
||||||
iframe.addClass('xubox_load').css({width: layerE.width()});
|
iframe.addClass('xubox_load').css({width: layerE.width()});
|
||||||
config.title[1] ? iframe.css({top: layerTitle.height(), height: heg - layerTitle.height()}) : iframe.css({top: 0, height : heg});
|
config.title ? iframe.css({top: layerTitle.height(), height: heg - layerTitle.height()}) : iframe.css({top: 0, height : heg});
|
||||||
layer.ie6 && iframe.attr('src', config.iframe.src);
|
layer.ie6 && iframe.attr('src', config.iframe.src);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -522,7 +516,7 @@ Class.pt.shift = function(type, rate, stop){
|
||||||
Class.pt.autoArea = function(times){
|
Class.pt.autoArea = function(times){
|
||||||
var that = this, times = times || that.index, config = that.config, page = config.page;
|
var that = this, times = times || that.index, config = that.config, page = config.page;
|
||||||
var layerE = $('#'+ doms[0] + times), layerTitle = layerE.find(doms[2]), layerMian = layerE.find(doms[5]);
|
var layerE = $('#'+ doms[0] + times), layerTitle = layerE.find(doms[2]), layerMian = layerE.find(doms[5]);
|
||||||
var titHeight = config.title[1] ? layerTitle.innerHeight() : 0, outHeight, btnHeight = 0;
|
var titHeight = config.title ? layerTitle.innerHeight() : 0, outHeight, btnHeight = 0;
|
||||||
if(config.area[0] === 'auto' && layerMian.outerWidth() >= config.maxWidth){
|
if(config.area[0] === 'auto' && layerMian.outerWidth() >= config.maxWidth){
|
||||||
layerE.css({width : config.maxWidth});
|
layerE.css({width : config.maxWidth});
|
||||||
}
|
}
|
||||||
|
@ -543,7 +537,7 @@ Class.pt.autoArea = function(times){
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
layerE.find('iframe').css({width: layerE.outerWidth(), height: layerE.outerHeight() - (config.title[1] ? layerTitle.innerHeight() : 0)});
|
layerE.find('iframe').css({width: layerE.outerWidth(), height: layerE.outerHeight() - (config.title ? layerTitle.innerHeight() : 0)});
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
var load = layerE.find(".xubox_loading");
|
var load = layerE.find(".xubox_loading");
|
||||||
|
@ -575,8 +569,9 @@ Class.pt.move = function(){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
config.move && that.layerE.find(config.move).attr('move','ok');
|
var movedom = that.layerE.find(config.move);
|
||||||
config.move ? that.layerE.find(config.move).css({cursor: 'move'}) : that.layerE.find(config.move).css({cursor: 'auto'});
|
config.move && movedom.attr('move','ok');
|
||||||
|
config.move ? movedom.css({cursor: 'move'}) : movedom.css({cursor: 'auto'});
|
||||||
|
|
||||||
$(config.move).on('mousedown', function(M){
|
$(config.move).on('mousedown', function(M){
|
||||||
M.preventDefault();
|
M.preventDefault();
|
||||||
|
@ -962,12 +957,11 @@ ready.run = function(){
|
||||||
(new Image()).src = layer.path + 'skin/default/xubox_ico0.png';
|
(new Image()).src = layer.path + 'skin/default/xubox_ico0.png';
|
||||||
};
|
};
|
||||||
|
|
||||||
//为支持seajs模块加载
|
|
||||||
var require = '../../init/jquery'; //若采用seajs,需正确配置jquery的相对路径。未用可无视此处。
|
var require = '../../init/jquery'; //若采用seajs,需正确配置jquery的相对路径。未用可无视此处。
|
||||||
if(window.seajs){
|
if(window.seajs){
|
||||||
define([require], function(require, exports, module){
|
define([require], function(require, exports, module){
|
||||||
ready.run();
|
ready.run();
|
||||||
exports.layer = [window.layer, window['$'].layer];
|
module.exports = layer;
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
ready.run();
|
ready.run();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@Name: layer's style
|
@Name: layer's style
|
||||||
@Date: 2012.09.15
|
@Date: 2012.09.15
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
.xubox_setwin .xubox_close1{position:absolute; right:-28px; top:-28px; width:30px; height:30px; margin-left:0; background-position:-60px -195px; *right:-18px; _right:-15px; _top:-23px; _width:14px; _height:14px; _background-position:-31px -7px;}
|
.xubox_setwin .xubox_close1{position:absolute; right:-28px; top:-28px; width:30px; height:30px; margin-left:0; background-position:-60px -195px; *right:-18px; _right:-15px; _top:-23px; _width:14px; _height:14px; _background-position:-31px -7px;}
|
||||||
.xubox_setwin .xubox_close1:hover{ background-position:-91px -195px; _background-position:-51px -7px;}
|
.xubox_setwin .xubox_close1:hover{ background-position:-91px -195px; _background-position:-51px -7px;}
|
||||||
|
|
||||||
.xubox_title{width:100%; height:35px; line-height:35px; border-bottom:1px solid #D5D5D5; background:url(default/xubox_title0.png) #EBEBEB repeat-x; cursor:move; font-size:14px; color:#333;}
|
.xubox_title{width:100%; height:35px; line-height:35px; border-bottom:1px solid #D5D5D5; background:url(default/xubox_title0.png) #EBEBEB repeat-x; font-size:14px; color:#333;}
|
||||||
.xubox_title em{height:20px; line-height:20px; width:60%; top:7px; left:10px; font-style:normal; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
|
.xubox_title em{height:20px; line-height:20px; width:60%; top:7px; left:10px; font-style:normal; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
|
||||||
|
|
||||||
.xubox_botton a{position:absolute; bottom:10px; left:50%; background:url(default/xubox_ico0.png) repeat; text-decoration:none; color:#FFF; font-size:14px; text-align:center; font-weight:bold; overflow:hidden; }
|
.xubox_botton a{position:absolute; bottom:10px; left:50%; background:url(default/xubox_ico0.png) repeat; text-decoration:none; color:#FFF; font-size:14px; text-align:center; font-weight:bold; overflow:hidden; }
|
||||||
|
|
Loading…
Reference in New Issue