Merge branch 'layui:main' into main

This commit is contained in:
sunxiaobin89 2022-08-16 10:04:57 +08:00 committed by GitHub
commit 91c7679b2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 605 additions and 153 deletions

View File

@ -19,15 +19,17 @@ body{padding: 100px;}
<body>
<div class="layui-btn-container">
<button class="layui-btn layui-btn-primary demo" data-type="test">Alert</button>
<button class="layui-btn demo" data-type="test2">Confirm</button>
<button class="layui-btn demo" data-type="test3">Msg</button>
<button class="layui-btn demo" data-type="test4">Tips</button>
<button class="layui-btn demo" data-type="test5">Page</button>
<button class="layui-btn demo" data-type="test6">Iframe</button>
<button class="layui-btn demo" data-type="test7">Prompt</button>
<button class="layui-btn demo" data-type="test8">Tab</button>
<a href="http://layer.layui.com/" target="_blank" class="layui-btn demo">更多例子</a>
<button class="layui-btn layui-btn-primary" lay-on="test">Alert</button>
<button class="layui-btn" lay-on="test2">Confirm</button>
<button class="layui-btn" lay-on="test3">Msg</button>
<button class="layui-btn" lay-on="test5">Page</button>
<button class="layui-btn" lay-on="test6">Iframe</button>
<button class="layui-btn" lay-on="testLoading">Loading</button>
<button class="layui-btn" lay-on="test4">Tips</button>
<button class="layui-btn" lay-on="test7">Prompt</button>
<button class="layui-btn" lay-on="test8">Tab</button>
<button class="layui-btn" lay-on="testTime">自动关闭</button>
<a href="https://layui.gitee.io/v2/demo/layer.html" target="_blank" class="layui-btn">更多例子</a>
</div>
<div id="test11111" style="display: none; padding: 20px;">
@ -38,12 +40,11 @@ body{padding: 100px;}
<div class="layui-list">
<ul class="layui-row" id="photos">
<li class="list"><img src="https://cdn.layui.com/upload/2017_3/168_1488985841996_23077.png"></li>
<li class="list"><img src="https://res.layui.com/static/images/fly/fly.jpg"></li>
<li class="list"><img src="https://unpkg.com/outeres/demo/1.jpg"></li>
<li class="list"><img src="https://unpkg.com/outeres/demo/2.jpg"></li>
</ul>
</div>
<script>
var LAYUI_GLOBAL = {
//path: '../src/'
@ -91,64 +92,63 @@ window.jQuery && runTest(1, window.jQuery, window.layer);
layui.use(['layer', 'util'], function(layer, util){
var $ = layui.jquery;
var util = layui.util;
//return
var index = layer.msg('hello');
var index = layer.msg('Hello World');
//layer.close(index);
//runTest(1, $, layer);
//触发事件
var active = {
// 触发事件
util.on('lay-on', {
test: function(){
layer.alert('你好么,体验者。<br>在标题栏显示自动关闭倒计秒数', {
time: 5*1000
,success: function(layero, index){
var timeNum = this.time/1000, setText = function(start){
layer.title((start ? timeNum : --timeNum) + ' 秒后关闭', index);
};
setText(!0);
this.timer = setInterval(setText, 1000);
if(timeNum <= 0) clearInterval(this.timer);
var icon = -1;
(function changeIcon(){
var index = layer.alert('Hi你好 点击确认更换图标', {
icon: icon,
shadeClose: true,
title: icon === -1 ? 'Alert' : ('icon: '+ icon)
}, changeIcon);
if(icon++ > 6){
layer.close(index);
icon = -1;
}
,end: function(){
clearInterval(this.timer);
}
});
}());
}
,test2: function(){
layer.confirm('您是如何看待前端开发', {
btn: ['重要','奇葩'] //按钮
layer.confirm('一个询问层的测试示例?', {
btn: ['确定','关闭'] //按钮
}, function(){
layer.msg('的确很重要', {icon: 1});
layer.msg('第一个回调', {icon: 1});
}, function(){
layer.msg('也可以这样', {
layer.msg('第二个回调', {
time: 20000, //20s后自动关闭
btn: ['明白了', '知道了']
});
});
}
,test3: function(){
layer.msg('提示中');
!1 ? layer.msg('一个常用消息框')
: layer.msg('一个常用消息框',{closeBtn: 0,time: 0, icon: 16});
}
,test4: function(){
layer.tips('Hi我是一个小提示', this, {tips: 1});
}
,test5: function(){
layer.open({
layer.open({
title:'自定义页面层',
type: 1,
skin: 'layui-layer-rim',
skin: 'layui-layer-border',
area: ['1000px', '580px'],
content: $('#test11111'),
maxmin: true,
shade: false,
minStack: false, //最小化不堆叠在左下角
id: 'page1', //定义 ID防止重复弹出
min: function(layero, index){
layer.msg('阻止了默认的最小化');
layer.style(index, {top: 'auto', bottom: 0});
return false;
}
});
@ -161,6 +161,12 @@ layui.use(['layer', 'util'], function(layer, util){
,maxmin: true
});
}
,testLoading: function(){
layer.load(2, {
//time: 5*1000
//content: '123'
});
}
,test7: function(){
layer.prompt({title: '输入任何口令,并确认', formType: 1}, function(pass, index){
layer.close(index);
@ -185,8 +191,23 @@ layui.use(['layer', 'util'], function(layer, util){
}]
});
}
};
,testTime: function(){
layer.alert('你好么,体验者。<br>在标题栏显示自动关闭倒计秒数', {
time: 5*1000
,success: function(layero, index){
var timeNum = this.time/1000, setText = function(start){
layer.title((start ? timeNum : --timeNum) + ' 秒后关闭', index);
};
setText(!0);
this.timer = setInterval(setText, 1000);
if(timeNum <= 0) clearInterval(this.timer);
}
,end: function(){
clearInterval(this.timer);
}
});
}
});
//相册层
layer.photos({
@ -201,16 +222,8 @@ layui.use(['layer', 'util'], function(layer, util){
//动态追加
$('#photos').append('<li class="list"><img src="https://res.layui.com/static/images/sentsin/night.gif"></li>');
//{"status":1,"msg":"","title":"JSON请求的相册","id":8,"start":0,"data":[{"alt":"layer","pid":109,"src":"//cdn.layui.com/upload/2017_3/168_1488985841996_23077.png","thumb":""},{"alt":"说好的,一起 Fly","pid":110,"src":"//res.layui.com/static/images/fly/fly.jpg","thumb":""},{"alt":"星空如此深邃","pid":113,"src":"//res.layui.com/static/images/sentsin/night.gif","thumb":""}]}
$('.demo').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
$('#photos').append('<li class="list"><img src="https://unpkg.com/outeres/demo/3.jpg"></li>');
});
</script>
</body>

View File

@ -544,8 +544,7 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-input, .layui-textarea, .layui-select,
.layui-form-pane .layui-form-label,
.layui-form-pane .layui-form-item[pane],
.layui-layedit, .layui-layedit-tool{border-color: #eee;}
.layui-form-pane .layui-form-item[pane]{border-color: #eee;}
.layui-border{border-width: 1px; border-style: solid; color: #5F5F5F!important;}
.layui-border-red{border-width: 1px; border-style: solid; border-color: #FF5722!important; color: #FF5722!important;}
@ -776,33 +775,6 @@ a cite{font-style: normal; *cursor:pointer;}
.layui-form-item .layui-form-checkbox{margin-right: 5px; margin-bottom: 5px;}
}
/** 富文本编辑器 **/
.layui-layedit{border-width: 1px; border-style: solid; border-radius: 2px;}
.layui-layedit-tool{padding: 3px 5px; border-bottom-width: 1px; border-bottom-style: solid; font-size: 0;}
.layedit-tool-fixed{position: fixed; top: 0; border-top: 1px solid #eee;}
.layui-layedit-tool .layedit-tool-mid,
.layui-layedit-tool .layui-icon{display: inline-block; vertical-align: middle; text-align: center; font-size: 14px;}
.layui-layedit-tool .layui-icon{position: relative; width: 32px; height: 30px; line-height: 30px; margin: 3px 5px; border-radius: 2px; color: #777; cursor: pointer; border-radius: 2px;}
.layui-layedit-tool .layui-icon:hover{color: #393D49;}
.layui-layedit-tool .layui-icon:active{color: #000;}
.layui-layedit-tool .layedit-tool-active{background-color: #eee; color: #000;}
.layui-layedit-tool .layui-disabled,
.layui-layedit-tool .layui-disabled:hover{color: #d2d2d2; cursor: not-allowed;}
.layui-layedit-tool .layedit-tool-mid{width: 1px; height: 18px; margin: 0 10px; background-color: #d2d2d2;}
.layedit-tool-html{width: 50px !important; font-size: 30px !important;}
.layedit-tool-b,
.layedit-tool-code,
.layedit-tool-help{font-size: 16px !important;}
.layedit-tool-d,
.layedit-tool-unlink,
.layedit-tool-face,
.layedit-tool-image{font-size: 18px !important;}
.layedit-tool-image input{position: absolute; font-size: 0; left: 0; top: 0; width: 100%; height: 100%; opacity: 0.01; filter: Alpha(opacity=1); cursor: pointer;}
.layui-layedit-iframe iframe{display: block; width: 100%;}
#LAY_layedit_code{overflow: hidden;}
/** 分页 **/
.layui-laypage{display: inline-block; *display: inline; *zoom: 1; vertical-align: middle; margin: 10px 0; font-size: 0;}
.layui-laypage>a:first-child,

156
src/css/modules/laydate.css Normal file
View File

@ -0,0 +1,156 @@
/**
@Name: laydata
**/
html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
/* 初始化 */
.layui-laydate *{margin: 0; padding: 0;}
/* 主体结构 */
.layui-laydate, .layui-laydate *{box-sizing: border-box;}
.layui-laydate{position: absolute; z-index: 66666666; margin: 5px 0; border-radius: 2px; font-size: 14px; -webkit-animation-duration: 0.2s; animation-duration: 0.2s; -webkit-animation-fill-mode: both; animation-fill-mode: both;}
.layui-laydate-main{width: 272px;}
.layui-laydate-header *,
.layui-laydate-content td,
.layui-laydate-list li{transition-duration: .3s; -webkit-transition-duration: .3s;}
/* 微微往下滑入 */
@keyframes laydate-downbit {
0% {opacity: 0.3; transform: translate3d(0, -5px, 0);}
100% {opacity: 1; transform: translate3d(0, 0, 0);}
}
.layui-laydate{animation-name: laydate-downbit;}
.layui-laydate-static{ position: relative; z-index: 0; display: inline-block; margin: 0; -webkit-animation: none; animation: none;}
/* 展开年月列表时 */
.laydate-ym-show .laydate-prev-m,
.laydate-ym-show .laydate-next-m{display: none !important;}
.laydate-ym-show .laydate-prev-y,
.laydate-ym-show .laydate-next-y{display: inline-block !important;}
.laydate-ym-show .laydate-set-ym span[lay-type="month"]{display: none !important;}
/* 展开时间列表时 */
.laydate-time-show .layui-laydate-header .layui-icon,
.laydate-time-show .laydate-set-ym span[lay-type="year"],
.laydate-time-show .laydate-set-ym span[lay-type="month"]{display: none !important;}
/* 头部结构 */
.layui-laydate-header{position: relative; line-height:30px; padding: 10px 70px 5px;}
.layui-laydate-header *{display: inline-block; vertical-align: bottom;}
.layui-laydate-header i{position: absolute; top: 10px; padding: 0 5px; color: #999; font-size: 18px; cursor: pointer;}
.layui-laydate-header i.laydate-prev-y{left: 15px;}
.layui-laydate-header i.laydate-prev-m{left: 45px;}
.layui-laydate-header i.laydate-next-y{right: 15px;}
.layui-laydate-header i.laydate-next-m{right: 45px;}
.laydate-set-ym{width: 100%; text-align: center; box-sizing: border-box; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
.laydate-set-ym span{padding: 0 10px; cursor: pointer;}
.laydate-time-text{cursor: default !important;}
/* 主体结构 */
.layui-laydate-content{position: relative; padding: 10px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;}
.layui-laydate-content table{border-collapse: collapse; border-spacing: 0;}
.layui-laydate-content th,
.layui-laydate-content td{width: 36px; height: 30px; padding: 5px; text-align: center;}
.layui-laydate-content th{font-weight: 400;}
.layui-laydate-content td{position: relative; cursor: pointer;}
.laydate-day-mark{position: absolute; left: 0; top: 0; width: 100%; line-height: 30px; font-size: 12px; overflow: hidden;}
.laydate-day-mark::after{position: absolute; content:''; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%;}
.laydate-day-holidays:before{position: absolute; left: 0; top: 0; font-size: 12px; transform: scale(.7);}
.laydate-day-holidays:before{content:'\4F11'; color: #FF5722;}
.laydate-day-holidays[type="work"]:before{content:'\73ED'; color: inherit;}
.layui-laydate .layui-this .laydate-day-holidays:before{color: #fff;}
/* 底部结构 */
.layui-laydate-footer{position: relative; height: 46px; line-height: 26px; padding: 10px;}
.layui-laydate-footer span{display: inline-block; vertical-align: top; height: 26px; line-height: 24px; padding: 0 10px; border: 1px solid #C9C9C9; border-radius: 2px; background-color: #fff; font-size: 12px; cursor: pointer; white-space: nowrap; transition: all .3s;}
.layui-laydate-footer span:hover{color: #5FB878;}
.layui-laydate-footer span.layui-laydate-preview{cursor: default; border-color: transparent !important;}
.layui-laydate-footer span.layui-laydate-preview:hover{color: #666;}
.layui-laydate-footer span:first-child.layui-laydate-preview{padding-left: 0;}
.laydate-footer-btns{position: absolute; right: 10px; top: 10px;}
.laydate-footer-btns span{margin: 0 0 0 -1px;}
/* 年月列表 */
.layui-laydate-list{position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding: 10px; box-sizing: border-box; background-color: #fff;}
.layui-laydate-list>li{position: relative; display: inline-block; width: 33.3%; height: 36px; line-height: 36px; margin: 3px 0; vertical-align: middle; text-align: center; cursor: pointer;}
.laydate-month-list>li{width: 25%; margin: 17px 0;}
.laydate-time-list{}
.laydate-time-list>li{height: 100%; margin: 0; line-height: normal; cursor: default;}
.laydate-time-list p{position: relative; top: -4px; line-height: 29px;}
.laydate-time-list ol{height: 181px; overflow: hidden;}
.laydate-time-list>li:hover ol{overflow-y: auto;}
.laydate-time-list ol li{width: 130%; padding-left: 33px; height: 30px; line-height: 30px; text-align: left; cursor: pointer;}
/* 提示 */
.layui-laydate-hint{position: absolute; top: 115px; left: 50%; width: 250px; margin-left: -125px; line-height: 20px; padding: 15px; text-align: center; font-size: 12px; color: #FF5722;}
/* 双日历 */
.layui-laydate-range{width: 546px;}
.layui-laydate-range .layui-laydate-main{display: inline-block; vertical-align: middle;}
.layui-laydate-range .laydate-main-list-1 .layui-laydate-header,
.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left: 1px solid #e2e2e2;}
/* 默认简约主题 */
.layui-laydate, .layui-laydate-hint{border: 1px solid #d2d2d2; box-shadow: 0 2px 4px rgba(0,0,0,.12); background-color: #fff; color: #666;}
.layui-laydate-header{border-bottom: 1px solid #e2e2e2;}
.layui-laydate-header i:hover,
.layui-laydate-header span:hover{color: #5FB878;}
.layui-laydate-content{border-top: none 0; border-bottom: none 0;}
.layui-laydate-content th{color: #333;}
.layui-laydate-content td{color: #666;}
.layui-laydate-content td.laydate-selected{background-color: #B5FFF8;}
.laydate-selected:hover{background-color: #00F7DE !important;}
.layui-laydate-content td:hover,
.layui-laydate-list li:hover{background-color: #eee; color: #333;}
.laydate-time-list li ol{margin: 0; padding: 0; border: 1px solid #e2e2e2; border-left-width: 0;}
.laydate-time-list li:first-child ol{border-left-width: 1px;}
.laydate-time-list>li:hover{background: none;}
.layui-laydate-content .laydate-day-prev,
.layui-laydate-content .laydate-day-next{color: #d2d2d2;}
.laydate-selected.laydate-day-prev,
.laydate-selected.laydate-day-next{background-color: #f8f8f8 !important;}
.layui-laydate-footer{border-top: 1px solid #e2e2e2;}
.layui-laydate-hint{color: #FF5722;}
.laydate-day-mark::after{background-color: #5FB878;}
.layui-laydate-content td.layui-this .laydate-day-mark::after{display: none;}
.layui-laydate-footer span[lay-type="date"]{color: #5FB878;}
.layui-laydate .layui-this{background-color: #009688 !important; color: #fff !important;}
.layui-laydate .laydate-disabled,
.layui-laydate .laydate-disabled:hover{background:none !important; color: #d2d2d2 !important; cursor: not-allowed !important; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;}
/* 墨绿/自定义背景色主题 */
.laydate-theme-molv{border: none;}
.laydate-theme-molv.layui-laydate-range{width: 548px}
.laydate-theme-molv .layui-laydate-main{width: 274px;}
.laydate-theme-molv .layui-laydate-header{border: none; background-color: #009688;}
.laydate-theme-molv .layui-laydate-header i,
.laydate-theme-molv .layui-laydate-header span{color: #f6f6f6;}
.laydate-theme-molv .layui-laydate-header i:hover,
.laydate-theme-molv .layui-laydate-header span:hover{color: #fff;}
.laydate-theme-molv .layui-laydate-content{border: 1px solid #e2e2e2; border-top: none; border-bottom: none;}
.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left: none;}
.laydate-theme-molv .layui-laydate-footer{border: 1px solid #e2e2e2;}
/* 格子主题 */
.laydate-theme-grid .layui-laydate-content td,
.laydate-theme-grid .layui-laydate-content thead,
.laydate-theme-grid .laydate-year-list>li,
.laydate-theme-grid .laydate-month-list>li{border: 1px solid #e2e2e2;}
.laydate-theme-grid .laydate-selected,
.laydate-theme-grid .laydate-selected:hover{background-color: #f2f2f2 !important; color: #009688 !important;}
.laydate-theme-grid .laydate-selected.laydate-day-prev,
.laydate-theme-grid .laydate-selected.laydate-day-next{color: #d2d2d2 !important;}
.laydate-theme-grid .laydate-year-list,
.laydate-theme-grid .laydate-month-list{margin: 1px 0 0 1px;}
.laydate-theme-grid .laydate-year-list>li,
.laydate-theme-grid .laydate-month-list>li{margin: 0 -1px -1px 0;}
.laydate-theme-grid .laydate-year-list>li{height: 43px; line-height: 43px;}
.laydate-theme-grid .laydate-month-list>li{height: 71px; line-height: 71px;}

182
src/css/modules/layer.css Normal file
View File

@ -0,0 +1,182 @@
/**
* layer style
*/
html #layuicss-layer{display: none; position: absolute; width: 1989px;}
/* common */
.layui-layer-shade, .layui-layer{position:fixed; _position:absolute; pointer-events: auto;}
.layui-layer-shade{top:0; left:0; width:100%; height:100%; _height:expression(document.body.offsetHeight+"px");}
.layui-layer{-webkit-overflow-scrolling: touch;}
.layui-layer{top:150px; left: 0; margin:0; padding:0; background-color:#fff; -webkit-background-clip: content; border-radius: 2px; box-shadow: 1px 1px 50px rgba(0,0,0,.3);}
.layui-layer-close{position:absolute;}
.layui-layer-content{position:relative;}
.layui-layer-border{border: 1px solid #B2B2B2; border: 1px solid rgba(0,0,0,.1); box-shadow: 1px 1px 5px rgba(0,0,0,.2);}
.layui-layer-setwin span,
.layui-layer-btn a{display:inline-block; *display:inline; *zoom:1; vertical-align:top;}
.layui-layer-move{display: none; position: fixed; *position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; cursor: move; opacity: 0; filter:alpha(opacity=0); background-color: #fff; z-index: 2147483647;}
.layui-layer-resize{position: absolute; width: 15px; height: 15px; right: 0; bottom: 0; cursor: se-resize;}
/* 动画 */
.layer-anim{-webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.3s; animation-duration:.3s;}
@-webkit-keyframes layer-bounceIn { /* 默认 */
0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)}
100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)}
}
@keyframes layer-bounceIn {
0% {opacity: 0; -webkit-transform: scale(.5); -ms-transform: scale(.5); transform: scale(.5)}
100% {opacity: 1; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1)}
}
.layer-anim-00{-webkit-animation-name: layer-bounceIn;animation-name: layer-bounceIn}
@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown}
@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig}
@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft}
@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0px) rotate(0deg);transform:translateX(0px) rotate(0deg)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0px) rotate(0deg);-ms-transform:translateX(0px) rotate(0deg);transform:translateX(0px) rotate(0deg)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn}
@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn}
@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}}
/* 标题栏 */
.layui-layer-title{padding:0 80px 0 20px; height: 50px; line-height: 50px; border-bottom:1px solid #F0F0F0; font-size: 14px; color:#333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 2px 2px 0 0;}
.layui-layer-setwin{position:absolute; right: 15px; *right:0; top: 16px; font-size:0; line-height: initial;}
.layui-layer-setwin span{position:relative; width: 16px; height: 16px; line-height: 18px; margin-left: 10px; text-align: center; font-size: 16px; cursor: pointer; color: #000; _overflow:hidden;}
.layui-layer-setwin .layui-layer-min:before{content: ''; position: absolute; width: 12px; height: 1px; left: 50%; top: 50%; margin: -0.5px 0 0 -6px; background-color: #2E2D3C; cursor: pointer; _overflow:hidden;}
.layui-layer-setwin .layui-layer-min:hover:before{background-color: #2D93CA}
.layui-layer-setwin .layui-layer-max:before,
.layui-layer-setwin .layui-layer-max:after{content: ''; position: absolute; left: 50%; top: 50%; z-index: 1; width: 9px; height: 9px; margin: -5px 0 0 -5px; border: 1px solid #2E2D3C;}
.layui-layer-setwin .layui-layer-max:hover:before,
.layui-layer-setwin .layui-layer-max:hover:after{border-color: #2D93CA;}
.layui-layer-setwin .layui-layer-min:hover:before{background-color: #2D93CA}
.layui-layer-setwin .layui-layer-maxmin:before,
.layui-layer-setwin .layui-layer-maxmin:after{width: 7px; height: 7px; margin: -3px 0 0 -3px; background-color: #fff;}
.layui-layer-setwin .layui-layer-maxmin:after{z-index: 0; margin: -5px 0 0 -1px;}
.layui-layer-setwin .layui-layer-close{cursor: pointer;}
.layui-layer-setwin .layui-layer-close:hover{opacity:0.7;}
.layui-layer-setwin .layui-layer-close2{position:absolute; right: -13px; top: -13px; padding: 3px; margin-left:0; color: #777; *right:-18px; _display:none;}
/* 按钮栏 */
.layui-layer-btn{text-align: right; padding: 0 15px 12px; pointer-events: auto; user-select: none; -webkit-user-select: none;}
.layui-layer-btn a{height: 28px; line-height: 28px; margin: 5px 5px 0; padding: 0 15px; border: 1px solid #dedede; background-color:#fff; color: #333; border-radius: 2px; font-weight:400; cursor:pointer; text-decoration: none;}
.layui-layer-btn a:hover{opacity: 0.9; text-decoration: none;}
.layui-layer-btn a:active{opacity: 0.8;}
.layui-layer-btn .layui-layer-btn0{border-color: #1E9FFF; background-color: #1E9FFF; color:#fff;}
.layui-layer-btn-l{text-align: left;}
.layui-layer-btn-c{text-align: center;}
/* 定制化 */
.layui-layer-dialog{min-width: 300px;}
.layui-layer-dialog .layui-layer-content{position: relative; padding:20px; line-height:24px; word-break: break-all; overflow:hidden; font-size:14px; overflow-x: hidden; overflow-y:auto;}
.layui-layer-dialog .layui-layer-content .layui-layer-face{position: absolute; top: 18px; left: 16px; color: #959595; font-size: 24px; _left: -40px;}
.layui-layer-dialog .layui-layer-content .layui-icon-tips{color: #F39B12;}
.layui-layer-dialog .layui-layer-content .layui-icon-ok{color: #5FB878;}
.layui-layer-dialog .layui-layer-content .layui-icon-close-fill{color: #FF5722;}
.layui-layer-dialog .layui-layer-content .layui-icon-password{color: #787878;}
.layui-layer-dialog .layui-layer-content .layui-icon-face-cry{color: #FF5722;}
.layui-layer-dialog .layui-layer-content .layui-icon-face-smile{color: #5FB878;}
.layui-layer-rim{border:6px solid #8D8D8D; border:6px solid rgba(0,0,0,.3); border-radius:5px; box-shadow: none;}
.layui-layer-msg{min-width:180px; border:1px solid #D3D4D3; box-shadow: none;}
.layui-layer-hui{min-width:100px; background-color: #000; filter:alpha(opacity=60); background-color: rgba(0,0,0,0.6); color: #fff; border:none;}
.layui-layer-hui .layui-layer-close{color: #fff;}
.layui-layer-hui .layui-layer-content{padding: 11px 24px; text-align: center;}
.layui-layer-dialog .layui-layer-padding{padding: 18px 24px 18px 52px; text-align: left;}
.layui-layer-page .layui-layer-content{position:relative; overflow:auto;}
.layui-layer-page .layui-layer-btn,.layui-layer-iframe .layui-layer-btn{padding-top:10px;}
.layui-layer-nobg{background:none;}
.layui-layer-iframe iframe{display: block; width: 100%;}
.layui-layer-loading{border-radius:100%; background:none; box-shadow:none; border:none;}
.layui-layer-loading .layui-layer-content{width: 76px; height: 38px; line-height: 38px; text-align: center;}
.layui-layer-loading-icon{font-size: 38px; color: #959595;}
.layui-layer-loading2{text-align: center;}
.layui-layer-loading-2{position: relative; height: 38px;}
.layui-layer-loading-2:before,
.layui-layer-loading-2:after{content: ''; position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; border: 3px solid #d2d2d2; box-sizing: border-box;}
.layui-layer-loading-2:after{border-color: transparent; border-left-color: #1E9FFF; border-right-color: #1E9FFF;}
.layui-layer-tips{background: none; box-shadow:none; border:none;}
.layui-layer-tips .layui-layer-content{position: relative; line-height: 22px; min-width: 12px; padding: 8px 15px; font-size: 12px; _float:left; border-radius: 2px; box-shadow: 1px 1px 3px rgba(0,0,0,.2); background-color: #000; color: #fff;}
.layui-layer-tips .layui-layer-close{right:-2px; top:-1px;}
.layui-layer-tips i.layui-layer-TipsG{ position:absolute; width:0; height:0; border-width:8px; border-color:transparent; border-style:dashed; *overflow:hidden;}
.layui-layer-tips i.layui-layer-TipsT, .layui-layer-tips i.layui-layer-TipsB{left:5px; border-right-style:solid; border-right-color: #000;}
.layui-layer-tips i.layui-layer-TipsT{bottom:-8px;}
.layui-layer-tips i.layui-layer-TipsB{top:-8px;}
.layui-layer-tips i.layui-layer-TipsR, .layui-layer-tips i.layui-layer-TipsL{top: 5px; border-bottom-style:solid; border-bottom-color: #000;}
.layui-layer-tips i.layui-layer-TipsR{left:-8px;}
.layui-layer-tips i.layui-layer-TipsL{right:-8px;}
/* skin */
.layui-layer-lan[type="dialog"]{min-width:280px;}
.layui-layer-lan .layui-layer-title{background:#4476A7; color:#fff; border: none;}
.layui-layer-lan .layui-layer-btn{padding: 5px 10px 10px; text-align: right; border-top:1px solid #E9E7E7}
.layui-layer-lan .layui-layer-btn a{background: #fff; border-color: #E9E7E7; color: #333;}
.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5;}
.layui-layer-molv .layui-layer-title{background: #009f95; color:#fff; border: none;}
.layui-layer-molv .layui-layer-btn a{background: #009f95; border-color: #009f95;}
.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1;}
/**
@Name: layer拓展样式
*/
/* prompt模式 */
.layui-layer-prompt .layui-layer-input{display: block; width: 260px; height: 36px; margin: 0 auto; line-height: 30px; padding-left: 10px; border: 1px solid #e6e6e6; color: #333;}
.layui-layer-prompt textarea.layui-layer-input{width: 300px; height: 100px; line-height: 20px; padding: 6px 10px;}
.layui-layer-prompt .layui-layer-content{padding: 20px;}
.layui-layer-prompt .layui-layer-btn{padding-top: 0;}
/* tab模式 */
.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4);}
.layui-layer-tab .layui-layer-title{padding-left:0; overflow: visible;}
.layui-layer-tab .layui-layer-title span{position:relative; float:left; min-width:80px; max-width: 300px; padding:0 20px; text-align:center; cursor:default; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; cursor: pointer;}
.layui-layer-tab .layui-layer-title span.layui-this{height: 51px; border-left: 1px solid #eee; border-right: 1px solid #eee; background-color: #fff; z-index: 10;}
.layui-layer-tab .layui-layer-title span:first-child{border-left:none;}
.layui-layer-tabmain{line-height:24px; clear:both;}
.layui-layer-tabmain .layui-layer-tabli{display:none;}
.layui-layer-tabmain .layui-layer-tabli.layui-this{display: block;}
/* photo模式 */
.layui-layer-photos{background: none; box-shadow: none;}
.layui-layer-photos .layui-layer-content{overflow:hidden; text-align: center;}
.layui-layer-photos .layui-layer-phimg img{position: relative; width:100%; display: inline-block; *display:inline; *zoom:1; vertical-align:top;}
.layui-layer-imgprev, .layui-layer-imgnext{position: fixed; top: 50%; width: 52px; height: 52px; line-height: 52px; margin-top: -26px; cursor: pointer; font-size: 52px; color: #717171;}
.layui-layer-imgprev{left: 32px;}
.layui-layer-imgnext{right: 32px;}
.layui-layer-imgprev:hover,
.layui-layer-imgnext:hover{color: #959595;}
.layui-layer-imgbar{position: fixed; left:0; right: 0; bottom:0; width:100%; height: 40px; line-height: 40px; background-color:#000\9; filter:Alpha(opacity=60); background-color: rgba(2,0,0,.35); color: #fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;}
.layui-layer-imgtit{/*position:absolute; left:20px;*/}
.layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;}
.layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;}
.layui-layer-imgtit a:hover{color:#fff; text-decoration:underline;}
.layui-layer-imgtit em{padding-left:10px; font-style: normal;}
/* 关闭动画 */
@-webkit-keyframes layer-bounceOut {
100% {opacity: 0; -webkit-transform: scale(.7); transform: scale(.7)}
30% {-webkit-transform: scale(1.05); transform: scale(1.05)}
0% {-webkit-transform: scale(1); transform: scale(1);}
}
@keyframes layer-bounceOut {
100% {opacity: 0; -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7);}
30% {-webkit-transform: scale(1.05); -ms-transform: scale(1.05); transform: scale(1.05);}
0% {-webkit-transform: scale(1); -ms-transform: scale(1);transform: scale(1);}
}
.layer-anim-close{-webkit-animation-name: layer-bounceOut; animation-name: layer-bounceOut; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.2s; animation-duration:.2s;}
@media screen and (max-width: 1100px) {
.layui-layer-iframe{overflow-y: auto; -webkit-overflow-scrolling: touch;}
}

View File

@ -1,6 +1,6 @@
/**
* layer - 通用 Web 弹出层组件
* MIT Licensed
* layer
* 通用 Web 弹出层组件
*/
;!function(window, undefined){
@ -24,7 +24,7 @@ var isLayui = window.layui && layui.define, $, win, ready = {
return GLOBAL.layer_dir || jsPath.substring(0, jsPath.lastIndexOf('/') + 1);
}(),
config: {}, end: {}, minIndex: 0, minLeft: [],
config: {}, end: {}, events: {resize: {}}, minIndex: 0, minLeft: [],
btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],
//五种原始层模式
@ -92,11 +92,11 @@ var isLayui = window.layui && layui.define, $, win, ready = {
//默认内置方法。
var layer = {
v: '3.5.1',
ie: function(){ //ie版本
v: '3.6.0',
ie: function(){ //ie 版本
var agent = navigator.userAgent.toLowerCase();
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
(agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
(agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于 ie11 并没有 msie 的标识
) : false;
}(),
index: (window.layer && window.layer.v) ? 100000 : 0,
@ -112,18 +112,23 @@ var layer = {
if(!options.extend) return this;
//加载 css
isLayui
? layui.addcss('modules/layer/' + options.extend)
: ready.link('theme/' + options.extend);
: ready.link('css/' + options.extend);
return this;
},
//主体CSS等待事件
//主体 CSS 等待事件
ready: function(callback){
var cssname = 'layer', ver = ''
,path = (isLayui ? 'modules/layer/' : 'theme/') + 'default/layer.css?v='+ layer.v + ver;
isLayui ? layui.addcss(path, callback, cssname) : ready.link(path, callback, cssname);
,path = (isLayui ? 'modules/' : 'css/') + 'layer.css?v='+ layer.v + ver;
isLayui ? (
layui['layui.all']
? (typeof callback === 'function' && callback())
: layui.addcss(path, callback, cssname)
) : ready.link(path, callback, cssname);
return this;
},
@ -256,21 +261,85 @@ Class.pt.vessel = function(conType, callback){
config.zIndex = zIndex;
callback([
//遮罩
// 遮罩
config.shade ? ('<div class="'+ doms.SHADE +'" id="'+ doms.SHADE + times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; ') +'"></div>') : '',
//主体
// 主体
'<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + ';position:'+ (config.fixed ? 'fixed;' : 'absolute;') +'">'
+ (conType && config.type != 2 ? '' : titleHTML)
+ '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
+ (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
// 内容区
+ '<div'+ (config.id ? ' id="'+ config.id +'"' : '') +' class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' : '') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
// 表情或图标
+ function(){
var face = [
'layui-icon-tips',
'layui-icon-ok',
'layui-icon-close-fill',
'layui-icon-help',
'layui-icon-password',
'layui-icon-face-cry',
'layui-icon-face-smile'
];
var additFaceClass;
// 动画类
var animClass = 'layui-anim layui-anim-rotate layui-anim-loop';
// 信息框表情
if(config.type == 0 && config.icon !== -1){
// 加载(加载图标)
if(config.icon == 16){
additFaceClass = 'layui-icon layui-icon-loading '+ animClass;
}
return '<i class="layui-layer-face layui-icon '+ (
additFaceClass || face[config.icon] || face[0]
) +'"></i>';
}
// 加载层图标
if(config.type == 3){
var type = [
'layui-icon-loading',
'layui-icon-loading-1'
];
// 风格 2
if(config.icon == 2){
return '<div class="layui-layer-loading-2 '+ animClass +'"></div>';
}
return '<i class="layui-layer-loading-icon layui-icon '+ (
type[config.icon] || type[0]
)+' '+ animClass +'"></i>'
}
return '';
}()
+ (config.type == 1 && conType ? '' : (config.content||''))
+ '</div>'
+ '<span class="layui-layer-setwin">'+ function(){
var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';
config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');
return closebtn;
}() + '</span>'
// 右上角按钮
+ '<div class="layui-layer-setwin">'+ function(){
var arr = [];
// 最小化、最大化
if(ismax){
arr.push('<span class="layui-layer-min"></span>');
arr.push('<span class="layui-layer-max"></span>');
}
// 关闭按钮
if(config.closeBtn){
arr.push('<span class="layui-icon layui-icon-close '+ [
doms[7],
doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2'))
].join(' ') +'"></span>')
}
return arr.join('');
}() + '</div>'
// 底部按钮
+ (config.btn ? function(){
var button = '';
typeof config.btn === 'string' && (config.btn = [config.btn]);
@ -294,7 +363,7 @@ Class.pt.creat = function(){
,conType = typeof content === 'object'
,body = $('body');
if(config.id && $('#'+config.id)[0]) return;
if(config.id && $('.'+ doms[0]).find('#'+ config.id)[0]) return;
if(typeof config.area === 'string'){
config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
@ -376,13 +445,15 @@ Class.pt.creat = function(){
}();
}();
//如果是固定定位
// 若是固定定位,则跟随 resize 事件来自适应坐标
if(config.fixed){
win.on('resize', function(){
that.offset();
(/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
config.type == 4 && that.tips();
});
if(!ready.events.resize[that.index]){
ready.events.resize[that.index] = function(){
that.resize();
};
// 此处 resize 事件不会一直叠加,当关闭弹层时会移除该事件
win.on('resize', ready.events.resize[that.index]);
}
}
config.time <= 0 || setTimeout(function(){
@ -404,6 +475,16 @@ Class.pt.creat = function(){
}
};
// 当前实例的 resize 事件
Class.pt.resize = function(){
var that = this;
var config = that.config;
that.offset();
(/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
config.type == 4 && that.tips();
};
//自适应
Class.pt.auto = function(index){
var that = this, config = that.config, layero = $('#'+ doms[0] + index);
@ -575,41 +656,66 @@ Class.pt.move = function(){
,config = that.config
,_DOC = $(document)
,layero = that.layero
,DATA_NAME = ['LAY_MOVE_DICT', 'LAY_RESIZE_DICT']
,moveElem = layero.find(config.move)
,resizeElem = layero.find('.layui-layer-resize')
,dict = {};
,resizeElem = layero.find('.layui-layer-resize');
if(config.move){
moveElem.css('cursor', 'move');
}
//给指定元素添加拖动光标
if(config.move) moveElem.css('cursor', 'move');
//按下拖动元素
moveElem.on('mousedown', function(e){
e.preventDefault();
var othis = $(this)
,dict = {};
if(config.move){
dict.moveStart = true;
dict.layero = layero;
dict.config = config;
dict.offset = [
e.clientX - parseFloat(layero.css('left'))
,e.clientY - parseFloat(layero.css('top'))
];
othis.data(DATA_NAME[0], dict);
ready.eventMoveElem = othis;
ready.moveElem.css('cursor', 'move').show();
}
});
resizeElem.on('mousedown', function(e){
e.preventDefault();
dict.resizeStart = true;
dict.offset = [e.clientX, e.clientY];
dict.area = [
layero.outerWidth()
,layero.outerHeight()
];
ready.moveElem.css('cursor', 'se-resize').show();
});
//按下右下角拉伸
resizeElem.on('mousedown', function(e){
var othis = $(this)
,dict = {};
if(config.resize){
dict.layero = layero;
dict.config = config;
dict.offset = [e.clientX, e.clientY];
dict.index = that.index;
dict.area = [
layero.outerWidth()
,layero.outerHeight()
];
othis.data(DATA_NAME[1], dict);
ready.eventResizeElem = othis;
ready.moveElem.css('cursor', 'se-resize').show();
}
e.preventDefault();
});
//拖动元素,避免多次调用实例造成事件叠加
if(ready.docEvent) return that;
_DOC.on('mousemove', function(e){
//拖拽移动
if(dict.moveStart){
if(ready.eventMoveElem){
var dict = ready.eventMoveElem.data(DATA_NAME[0]) || {}
,layero = dict.layero
,config = dict.config;
var X = e.clientX - dict.offset[0]
,Y = e.clientY - dict.offset[1]
,fixed = layero.css('position') === 'fixed';
@ -629,6 +735,7 @@ Class.pt.move = function(){
Y > setBot && (Y = setBot);
}
//拖动时跟随鼠标位置
layero.css({
left: X
,top: Y
@ -636,31 +743,41 @@ Class.pt.move = function(){
}
//Resize
if(config.resize && dict.resizeStart){
if(ready.eventResizeElem){
var dict = ready.eventResizeElem.data(DATA_NAME[1]) || {}
,config = dict.config;
var X = e.clientX - dict.offset[0]
,Y = e.clientY - dict.offset[1];
e.preventDefault();
layer.style(that.index, {
//拉伸宽高
layer.style(dict.index, {
width: dict.area[0] + X
,height: dict.area[1] + Y
})
dict.isResize = true;
config.resizing && config.resizing(layero);
});
config.resizing && config.resizing(dict.layero);
}
}).on('mouseup', function(e){
if(dict.moveStart){
delete dict.moveStart;
if(ready.eventMoveElem){
var dict = ready.eventMoveElem.data(DATA_NAME[0]) || {}
,config = dict.config;
ready.eventMoveElem.removeData(DATA_NAME[0]);
delete ready.eventMoveElem;
ready.moveElem.hide();
config.moveEnd && config.moveEnd(layero);
config.moveEnd && config.moveEnd(dict.layero);
}
if(dict.resizeStart){
delete dict.resizeStart;
if(ready.eventResizeElem){
ready.eventResizeElem.removeData(DATA_NAME[1]);
delete ready.eventResizeElem;
ready.moveElem.hide();
}
});
ready.docEvent = true; //已给 document 执行全局事件
return that;
};
@ -683,21 +800,21 @@ Class.pt.callback = function(){
var index = $(this).index();
if(index === 0){
if(config.yes){
config.yes(that.index, layero)
config.yes(that.index, layero, that);
} else if(config['btn1']){
config['btn1'](that.index, layero)
config['btn1'](that.index, layero, that);
} else {
layer.close(that.index);
}
} else {
var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);
var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero, that);
close === false || layer.close(that.index);
}
});
//取消
function cancel(){
var close = config.cancel && config.cancel(that.index, layero);
var close = config.cancel && config.cancel(that.index, layero, that);
close === false || layer.close(that.index);
}
@ -713,7 +830,7 @@ Class.pt.callback = function(){
//最小化
layero.find('.layui-layer-min').on('click', function(){
var min = config.min && config.min(layero, that.index);
var min = config.min && config.min(layero, that.index, that);
min === false || layer.min(that.index, config);
});
@ -721,11 +838,11 @@ Class.pt.callback = function(){
layero.find('.layui-layer-max').on('click', function(){
if($(this).hasClass('layui-layer-maxmin')){
layer.restore(that.index);
config.restore && config.restore(layero, that.index);
config.restore && config.restore(layero, that.index, that);
} else {
layer.full(that.index, config);
setTimeout(function(){
config.full && config.full(layero, that.index);
config.full && config.full(layero, that.index, that);
}, 100);
}
});
@ -955,14 +1072,24 @@ layer.full = function(index){
//改变title
layer.title = function(name, index){
var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);
var title = $('#'+ doms[0] + (index || layer.index)).find(doms[1]);
title.html(name);
};
//关闭layer总方法
//关闭 layer 总方法
layer.close = function(index, callback){
var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
var layero = function(){
var closest = $('.'+ doms[0]).find('#'+ index).closest('.'+ doms[0]);
return closest[0] ? (
index = closest.attr('times')
,closest
) : $('#'+ doms[0] + index)
}()
,type = layero.attr('type')
,closeAnim = 'layer-anim-close';
if(!layero[0]) return;
var WRAP = 'layui-layer-wrap', remove = function(){
if(type === ready.type[1] && layero.attr('conType') === 'object'){
layero.children(':not(.'+ doms[5] +')').remove();
@ -975,7 +1102,7 @@ layer.close = function(index, callback){
//低版本IE 回收 iframe
if(type === ready.type[2]){
try {
var iframe = $('#'+doms[4]+index)[0];
var iframe = $('#'+ doms[4] + index)[0];
iframe.contentWindow.document.write('');
iframe.contentWindow.close();
layero.find('.'+doms[5])[0].removeChild(iframe);
@ -984,9 +1111,16 @@ layer.close = function(index, callback){
layero[0].innerHTML = '';
layero.remove();
}
typeof ready.end[index] === 'function' && ready.end[index]();
delete ready.end[index];
typeof callback === 'function' && callback();
// 移除 reisze 事件
if(ready.events.resize[index]){
win.off('resize', ready.events.resize[index]);
delete ready.events.resize[index];
}
};
if(layero.data('isOutAnim')){
@ -996,6 +1130,7 @@ layer.close = function(index, callback){
$('#layui-layer-moves, #'+ doms.SHADE + index).remove();
layer.ie == 6 && ready.reselect();
ready.rescollbar(index);
if(layero.attr('minLeft')){
ready.minIndex--;
ready.minLeft.push(layero.attr('minLeft'));
@ -1227,9 +1362,6 @@ layer.photos = function(options, loop, key){
photos.start = dict.imgIndex - 1;
layer.close(dict.index);
return layer.photos(options, true, key);
setTimeout(function(){
layer.photos(options, true, key);
}, 200);
}
//一些动作
@ -1321,7 +1453,7 @@ layer.photos = function(options, loop, key){
+function(){
if(data.length > 1){
return '<div class="layui-layer-imgsee">'
+'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>'
+'<div class="layui-layer-imguide"><span class="layui-icon layui-icon-left layui-layer-iconext layui-layer-imgprev"></span><span class="layui-icon layui-icon-right layui-layer-iconext layui-layer-imgnext"></span></div>'
+'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt || '') +'</a><em>'+ dict.imgIndex +' / '+ data.length +'</em></span></div>'
+'</div>'
}
@ -1383,7 +1515,4 @@ window.layui && layui.define ? (
}()
);
}(window);
}(window);