pull/3/head
sentsin 2014-08-13 08:07:46 +08:00
parent 2ec5ca38e5
commit b523c15f5f
4 changed files with 38 additions and 48 deletions

View File

@ -1,13 +1,13 @@
/**
@Name: layer拓展类依赖于layer
@Date: 2014.07.04
@Date: 2014.08.13
@Author: 贤心
@Versions1.8.4-ext
@Versions1.8.5-ext
@Apihttp://sentsin.com/jquery/layer
@Desc: 本拓展会持续更新
**/
*/
layer.use('skin/layer.ext.css', function(){
layer.ext && layer.ext();
@ -17,9 +17,8 @@ layer.use('skin/layer.ext.css', function(){
/**
系统prompt
By 贤心
**/
*/
layer.prompt = function(parme, yes, no){
var log = {}, parme = parme || {}, conf = {
@ -51,10 +50,11 @@ layer.prompt = function(parme, yes, no){
}, no: no
}, success: function(){
log.prompt = $('#xubox_prompt');
log.prompt.focus();
}
};
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);
};
@ -63,9 +63,8 @@ layer.prompt = function(parme, yes, no){
/**
tab层
By 贤心
**/
*/
layer.tab = function(parme){
var log = {}, parme = parme || {}, data = parme.data || [], conf = {
@ -128,9 +127,8 @@ layer.tab = function(parme){
/**
相册层
By 贤心
**/
*/
layer.photos = function(options){

View File

@ -1,15 +1,13 @@
/**************************************************************
/****************************************
@Namelayer v1.8.4 弹层组件开发版
@Namelayer v1.8.5 弹层组件开发版
@Author贤心
@Date2014-07-07
@Date2014-08-13
@Bloghttp://sentsin.com
@QQ群78803422 (layer组件群3)
@CopyrightSentsin Xu(贤心)
@官网http://sentsin.com/jquery/layer
@授权http://url.cn/RAejZY
*************************************************************/
*/
;!function(window, undefined){
"use strict";
@ -29,7 +27,7 @@ $, win, ready = {
//默认内置方法。
window.layer = {
v: '1.8.4',
v: '1.8.5',
ie6: !-[1,] && !window.XMLHttpRequest,
index: 0,
path: ready.getPath(),
@ -160,7 +158,7 @@ Class.pt.config = {
shade: [0.3, '#000'],
fix: true,
move: '.xubox_title',
title: ['信息', true],
title: '信息',
offset: ['', '50%'],
area: ['310px', 'auto'],
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>';
}
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.title[1] && (title = '<div class="xubox_title"><em>' + config.title[0] + '</em></div>');
var titype = typeof config.title === 'object';
config.title && (title = '<div class="xubox_title" style="'+ (titype ? config.title[1] : '') +'"><em>' + (titype ? config.title[0] : config.title) + '</em></div>');
return [shade,
'<div times="'+ times +'" showtime="'+ config.time +'" style="z-index:'+ zIndex +'" id="'+ doms[0] +''+ times
+'" class="'+ doms[0] +'">'
@ -224,14 +222,10 @@ Class.pt.creat = function(){
space = that.space(html);
body.append($(space[0]));
};
if(config.title === false){
config.title = [];
} else if(typeof config.title === 'string') {
config.title = [config.title, true]
}
switch(config.type){
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'));
break;
@ -257,14 +251,14 @@ Class.pt.creat = function(){
break;
case 3:
config.title = [];
config.title = false;
config.area = ['auto', 'auto'];
config.closeBtn = ['', false];
$('.xubox_loading')[0] && layer.closeLoad();
break;
case 4:
config.title = [];
config.title = false;
config.area = ['auto', 'auto'];
config.fix = false;
config.border = [0];
@ -282,7 +276,7 @@ Class.pt.creat = function(){
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');
confbtn.btn = config.btn || dialog.btn;
switch(confbtn.btns){
@ -350,7 +344,7 @@ Class.pt.set = function(times){
that.autoArea(times);
if(config.title[1]){
if(config.title){
if(config.type === 0){
layer.ie6 && layerTitle.css({width : layerE.outerWidth()});
}
@ -377,7 +371,7 @@ Class.pt.set = function(times){
switch(config.type){
case 0:
layerE.find(doms[5]).css({'background-color': '#fff'});
if(config.title[1]){
if(config.title){
layerE.find(doms[3]).css({paddingTop: 18 + layerTitle.outerHeight()});
}else{
layerE.find('.xubox_msgico').css({top: 8});
@ -388,13 +382,13 @@ Class.pt.set = function(times){
case 1:
layerE.find(page.dom).addClass('layer_pageContent');
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;
case 2:
var iframe = layerE.find('.'+ doms[1]), heg = layerE.height();
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);
break;
@ -522,7 +516,7 @@ Class.pt.shift = function(type, rate, stop){
Class.pt.autoArea = function(times){
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 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){
layerE.css({width : config.maxWidth});
}
@ -543,7 +537,7 @@ Class.pt.autoArea = function(times){
}
break;
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;
case 3:
var load = layerE.find(".xubox_loading");
@ -575,8 +569,9 @@ Class.pt.move = function(){
}
};
config.move && that.layerE.find(config.move).attr('move','ok');
config.move ? that.layerE.find(config.move).css({cursor: 'move'}) : that.layerE.find(config.move).css({cursor: 'auto'});
var movedom = that.layerE.find(config.move);
config.move && movedom.attr('move','ok');
config.move ? movedom.css({cursor: 'move'}) : movedom.css({cursor: 'auto'});
$(config.move).on('mousedown', function(M){
M.preventDefault();
@ -962,12 +957,11 @@ ready.run = function(){
(new Image()).src = layer.path + 'skin/default/xubox_ico0.png';
};
//为支持seajs模块加载
var require = '../../init/jquery'; //若采用seajs需正确配置jquery的相对路径。未用可无视此处。
if(window.seajs){
define([require], function(require, exports, module){
ready.run();
exports.layer = [window.layer, window['$'].layer];
module.exports = layer;
});
}else{
ready.run();

12
layer.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
/**
/**
@Name: layer's style
@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: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_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; }