diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 61effe66..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,223 +0,0 @@ - -# v3.1.1 2017年12月05日 - -* 优化自动获取路径代码,以解决部分浏览器下的某些场景无法自动加载样式问题 - ---- - -# v3.1.0 2017年09月13日 - -* 紧急修复在最新版 Chrome(61.0.3163.79)下遮罩层出现的奇异花屏现象 -* 修复 layer.js 未设置btnAlign时,包裹按钮的 div.layui-layer-btn 出现一多余 class -* 对默认按钮颜色、Tips层、Prompt层、Tab层等进行了样式调整,以便更显大气,且更符合layui风格 -* 增加maxHeight参数,用于设定弹层的最大高度 -* 去除 type:2 时如果content未填写而弹出 layer 官网的默认设置 - - ---- - - -# v3.0.3 2017年03月06日 - -* 增加参数 isOutAnim,用于控制是否显示关闭动画,true 或者 false -* 撤销自动ready处理机制,因为在初始时与Ajax同步等使用场景存在耦合等问题 -* 修复Firefox下对默认层设置了高度,按钮被溢出的bug -* photos层的出场动画不再是随机,而是采用默认动画(也可以通过参数 anim 来自定义) -* 去除photos层的默认关闭动画(觉得觉得不闪眼的话,也可以通过参数isOutAnim开启) - - ---- - - -# v3.0.2 2017年02月25日 - -* 新增 resizing 回调,用于监听窗口的调整大小 -* 增加自动ready处理机制,即如果你页面一打开就执行弹层,无需放入layer.ready中 -* 对moveEnd回调返回一个参数为当前容器的DOM对象 -* 添加一个amd条件,避免 define出错(Merge pull request #42 from wangyateng/master) -* 修复tab,photos,prompt弹层默认success回调被覆盖导致功能不正常的问题(来自github用户 @waychan23 的友情提醒) -* 完善多按钮场景换行的间距(之前是紧贴在一起,略不雅观) -* 弹出图片层的动画时间改为800ms -* 修复按方向键切换图片层过快时重复弹出的bug -* 修复与animate.css可能存在的动画冲突 - - ---- - - -# v3.0 2016年11月07日 - -* 新增拖动弹层右下角可调节弹层尺寸的功能,由参数resize控制,默认开启。对loading、tips层无效 -* offset参数新增 t、r、b、l、lt、lb、rt、rb、的赋值,可快捷实现上、右、下、左、左上角、左下角、右上角、右下角的边缘定位 -* 新增btnAlign参数,支持三个参数:l/c/r,分别用于控制按钮居左、居中、居右的快捷设置(默认r,即居右) -* 点击最小化时,自动定位到页面左下角,在出现多个最小化时,会依次排列,这是一次较为重大的完善。 -* 新增关闭层的过度动画(可通过 anim: -1 统一取消动画) - -* 重写拖拽核心代码,性能大幅度提升 -* layer.config核心调整 -* layer.config中的extend参数只提供加载一个css皮肤文件(详见文档) -* 处理在head标签中执行layer弹层无效的情况 -* 瘦身layer.ready方法 -* 修改iframe层的loading动画 -* 捕获页类型的弹层在关闭时,会根据所捕获元素的初始display值,进行不同处理,即不再强制隐藏。 - -* 剔除moveType参数,只提供默认的一种拖拽风格 -* 剔除语义欠佳的fix参数,改为fixed取代 -* 剔除语义欠佳的shift参数,改为anim取代,不过仍然对shift参数兼容 - -* 完善tips层细节 -* 将prompt层改成页面层结构,即当你弹出prompt层时,再弹出msg,不会将prompt销毁。 -* prompt层的textarea模式支持area参数来设定宽高 -* layer.css大面积改善 -* 降解IE6的fixed支持,不过仍然对ie6兼容(话说现在全浏览器兼容的组件已经不多了,layer后续会整理出不兼容ie6/7的版本) - -* 修改图片超出屏幕后,重新计算大小的算法(Merge pull request from 390029659/master) -* 修复iframe层在用于iPhone设备时,无法触发滚动的Bug - - ---- - - -# v2.4 2016年07月03日 - -* 兼容jQuery3.0 -* 优化tips,可支持配置参数fix(之前是强制fix: false),用于决定是固定的tips还是非固定的。 -* min回调可通过return false来设定不执行默认最小化。 -* 修复在移动端使用iframe,IOS下无法滑动的bug。 -* 细节优化及样式微调 - -# 【v2.3】2016年05月18日 -* 通过对使用频率的调查,将layer.ext.js(拓展模块)合并到了layer.js,即不用再通过layer.config来加载调用。 -* cancel回调不再对第二个按钮有效,只作为右上角关闭按钮触发。并且除yes回调外,所以按钮的回调都可以通过return false来设定不默认关闭。 -* 修复相册层,点击任意图片查看,弹出的并非当前图片的bug。 -* 修复相册层在移动端显示不佳的bug。 -* 修复msg、alert等对话框类型的弹层,在手机使用时未水平居中的bug。 - -# 【v2.2】2016年03月18日 -* 增加参数id,用于控制弹层唯一标识。如不想重复弹出,可设置该值。 -* layer.tips允许出现遮罩,即不对shade参数做限制。 -* 对layer.photos方法直接弹出页面图片进行了事件委托,修复了之前由于动态插入的img而无法执行弹出的bug,并且修复了当图片信息改变时,仍然弹出了之前的图片的bug -* layer.photos方法多处代码进行了优化 -* 对layer.tab方法新增回调函数change,用于监听选项卡的切换事件,返回一个选项卡索引参数。 -* 样式微调 - - -# 【v2.1】2015年11月04日 -* 修复在使用seajs或者requirejs后,layer.ext.js报layer未定义的错误。 -* 修复弹出层后,回车键无效的bug。 -* 修复iframe层的success回调在ie8以下浏览器无效的bug -* 修复只有一张图片时,并且该图片地址异常,不断弹出提示的bug。 -* 修复当设定moveEnd回调,即便层关闭,仍然触发该回调的bug -* 即便采用模块加载,layer对象仍然保留全局,原因是layer自有模块需要。 -* 优化图标锯齿消的回调除了yes和cancel外,还可用btn1/btn2。 btn2可解决取消遇右上角关闭共用cancel回调的问题。即如果你只需要接受取消的回调,可以使用 btn2: function(){} - - -# 【v2.0】2015年09月01日 -* 全新的默认皮肤 -* 修复按住Enter键时,出现不断弹层的bug。 -* 修复模块加载时,layer仍然暴露给了全局的bug。 -* 修复拖拽完毕回调moveEnd,在层关闭后拖拽鼠标仍然触发该回调的bug。 -* 确认和取消的回调除了yes和cancel外,还可用btn1/btn2。 btn2可解决取消遇右上角关闭共用cancel回调的问题。即如果你只需要接受取消的回调,可以使用 btn2: function(){} - -### 拓展模块 -* 修复通过script标签引入layer.ext.js时,出现Cannot read property 'skin' of undefined的报错问题。(虽然我们更推荐用layer.config()方式加载layer.ext.js)。 -* 如果相册只有一张图片,则不触发上/下一张。 - - ---- - - -# 【v1.9.3】2015年05月23日 -* 修复全局设置皮肤时,部分类型层未起作用的bug。 -* 增加skin值:layui-layer-rim,用于给层加边框(类似1.85的风格) -* 样式微调 - -### 拓展模块 -* 修复相册层设定基础参数时,只有首次有效的bug。 - - -# 【v1.9.2】2015年05月08日 -* 增加关闭动画样式:layui-layer-close -* 优化默认弹出动画 -* 优化默认图标,默认的icon支持缩减到0-6(拓展皮肤可自己任意设定支持的数目) -* 优化部分样式 -* 机智地修复了一个隐藏得非常深的但是不是太重要的bug。 -* 剔除了一些图片。 - -# 【v1.9.1】2015年04月29日 -* btn设定多个按钮时,新增对应的回调(支持只有yes和cancel回调),如btn: ['按钮一','按钮二','按钮三'],按钮一和按钮二还是之前的yes和cancel,按钮三,则回调为 btn3: function(){},以此类推。 -* 对cancel回调进行了微完善,如果不想关闭,return false即可,如cancel: function(){return false},取消则不会关闭。 -* 修复当设置了fix:false时,offset的设置无效的bug -* 为低版本IE回收iframe占用的内存,从而修复偶尔无法获焦的bug -* 修复当设置了btn时,最小化不能愉快地呈现的bug。 -* 修复全局设置skin时,某些层类型出现样式异常的bug。 -* 修复area设置了百分比时,maxmin参数无效的bug。 -* 完善当采用script标签合并路径的方式引入layer,加载了错误的css路径的问题。这种情况需在script标签上加一个自定义属性merge="true",然后通过layer.config({path: 'layer所在目录'})来完成初始化的配置 -* 样式微调 - -# 【v1.9.0】2015年04月19日 - -* 新增laye.open(options),抛弃了之前的$.layer(options)调用方法,目的是与layer mobile保持统一。 -* 新增layer.config(options)方法,用于进行全局化配置。除了用于展现弹层的基础参数外,还支持path,用于模块化加载layer时设定目录以便加载所需配件,如layer.config({path: '所在路径', extend: ''}); -* 新增content参数,用于统一传入内容。支持string类型和jquery dom对象。如果是type:2,即iframe的url。 -* 新增icon参数,用于统一配置对话框和loading的icon类型。 -* 新增cancel参数,用于统一取消回调。 -* 新增skin参数,用于控制层的不同外观。 -* 新增layer.ready(path, callback),用于页面加载时即调用弹层。如果通过layer.config配置了path,此方法的path可以不填,即直接layer.ready(callback); -* 新增tipsMore,用于开启多个tips -* 新增scrollbar,用于设定是否屏蔽浏览器滚动条 - -* 完善offset参数,除了跟之前一样,[Y坐标, X坐标],还支持传入'rd',表示右下角。另外还支持只传入Y坐标,如offset: '120px'。默认'auto',即垂直水平居中。 -* 完善自适应,只要设定了固定高度,任何层都会自适应出现滚动条 -* 完善shift,全新的CSS3动画模式,支持传入0-6。 -* 完善area,支持传入宽度、[宽,高],默认'auto',表示自适应 -* 完善time,传入值改为毫秒,比如2秒关闭,time: 2000 -* 完善use方法,修复之前初始调用时部分浏览器一些不稳定因素 -* 完善layer.full/layer.min方法,只要传入index即可,不用跟之前一样还要传入area和offset。。。 -* layer.alert/confirm/msg/load/tips五种快捷引用重写,更灵活,更易使用。 - -* 剔除border参数,因为它没有本质的作用,自定义层样式可以通过新增的skin参数 -* 剔除dialog的msg,page的html/url/dom,统一采用content -* 剔除dialog和loading的type,统一采用icon -* 剔除dialog中用于配置按钮数的btns,因为可直接通过btn本身来获取。 -* 剔除no和close回调,统一采用cancel取代,不过仍然对前两者兼容。 -* 剔除layer.closeLoad()、layer.closeTips()方法,统一用layer.closeAll('loading/tips')来对指定类型层进行关闭 -* 剔除bgcolor参数,因为自定义的样式一律采用skin参数控制 -* 剔除tips一些列子元素,只保留自身,并且支持number和object形,用于设定方向和显示箭头。 -* 剔除layer.getIndex方法,获取索引统一用返回值 -* 剔除layer.autoArea方法,因为已经采取更好的自适应方案。 - -* 默认不显示dialog图标,需要显示配置dialog指定的type即可 -* 很多不可见只可感受的细节改动 - -### 拓展模块 -* layer.prompt/layer.tab/layer.photos重写,代码更强健,功能更强大,详见Api。 - - -总之!总之...layer1.9.0有着太多的调整,爱她,就认真去感受她!么么哒 - -——贤心 2015年4月15日 - - ---- - - - -# 【v1.8.5】 -* 新增对title样式的自定义控制 -* 修复layer.prompt多行文本,设置默认值无效的bug - -# 【v1.8.4】 -* 新增浏览器窗口尺寸改变时的自适应定位 -* 新增属性shift,用于配置动画弹出(需要注意的是,之前的layer.shift()方法将在layer1.9遗弃,用shift属性取代) -* 新增方法layer.title(name, index); 用于动态改变层的标题。 -* 修改弹出层默认初始坐标为垂直左右居中。 -* 开放多个tips,可通过配置tips: {more: true}开启。 -* 进一步完善tips的智能定位。 -* 放弃layer.ready方法,用jQuery的ready取代。 -* 进一步优化内部代码 - -### 拓展模块 -* layer.prompt支持给表单传入默认值,如layer.prompt({val:'默认'}); 新增yes回调函数第二个参数为索引、第三个参数为表单元素。 -* 相册层新增tab回调函数,用于切换图片时进行相关操作 -* 相册层内部代码优化。 diff --git a/README.md b/README.md index 349e31a5..ba7c599f 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,18 @@ +## 📣 提示 + +**layer 组件已完全集成到 Layui 中,不再做单独维护。建议直接使用 layui 中 layer。** + +> layer 文档:https://layui.dev/docs/layer/ + ## 概要 -layer是一款近年来备受青睐的web弹层组件,这完全得益于她全方位的解决方案。她致力于服务各个水平段的开发人员,您的页面会轻松地拥有丰富友好的操作体验。在与同类组件的比较中,layer总是能轻易获胜。她尽可能地在以更少的代码展现更强健的功能,且格外注重性能的提升、易用和实用性,正因如此,越来越多的开发者将媚眼投上了layer。layer兼容了包括IE6在内的所有主流浏览器。 她数量可观的接口,使得您可以自定义太多您需要的风格,每一种弹层模式各具特色,皆广受欢迎。当然,这种"王婆卖瓜"的陈述听起来总是有点难受,因此你需要进一步了解她是否真的如你所愿。 +layer 是一款历来都备受青睐的 Web 弹出层组件,具备全方位的解决方案,面向的是各个水平段的开发人员,您的页面会轻松地拥有丰富友好的操作体验。在与同类组件的比较中,layer 会更能被开发者所选择。这不仅是凭「脸」取胜,而是它尽可能地在以更少的代码展现更强健的功能,且格外注重性能的提升、易用和实用性,layer 甚至还兼容了包括 IE6 在内的所有主流浏览器。其数量可观的基础属性和方法,使得您可以自定义太多您需要的风格,每一种弹层模式各具特色,广受欢迎。当然,这种「王婆卖瓜」的陈述听起来总是有点难受,因此你需要进一步了解她是否真的如你所愿。 -[文档与演示](http://layer.layui.com/) +[文档与演示](http://layui.dev/docs/2/layer/) ## 愿景 -layer致力于打造国内最盛行的弹层组件,为web开发提供强劲动力。 - -## 现状 -因着数年的坚持维护,截至到2017年03月21日,已运用在超过30万家Web平台,其中不乏众多知名大型网站。目前layer已经成为国内乃至全世界最多人使用的Web弹层解决方案,并且她仍在与Layui一并高速发展。 +成为网页弹出层的首先交互方案 +## 影响 +因着数年的坚持维护,layer 已被运用在不计其数 Web 平台,几乎所处可见,其中还不乏众多知名大型网站。layer 已被国内乃至全世界至少数十万的开发者所使用过。 -## 相关 -[官网](http://layer.layui.com/)、[社区](http://fly.layui.com) \ No newline at end of file diff --git a/bower.json b/bower.json deleted file mode 100644 index bf96eac3..00000000 --- a/bower.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "layer", - "main": "src/layer.js", - "version": "3.1.0", - "homepage": "https://github.com/sentsin/layer", - "authors": [ - "sentsin " - ], - "description": "弹窗组件", - "moduleType": [ - "amd", - "globals" - ], - "keywords": [ - "layer", - "layui", - "dialog" - ], - "license": "MIT" -} diff --git a/dist/layer.js b/dist/layer.js index 12cb6b5c..c6bc68b8 100644 --- a/dist/layer.js +++ b/dist/layer.js @@ -1,2 +1,2 @@ -/*! layer-v3.1.1 Web弹层组件 MIT License http://layer.layui.com/ By 贤心 */ - ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(o.getStyle(document.getElementById(f),"width"))?i():setTimeout(u,100))}()}}},r={v:"3.1.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),document.body?t.creat():setTimeout(function(){t.creat()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
'+(f?r.title[0]:r.title)+"
":"";return r.zIndex=s,t([r.shade?'
':"",'
'+(e&&2!=r.type?"":u)+'
'+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
'+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
'+e+"
"}():"")+(r.resize?'':"")+"
"],u,i('')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='[フレーム]';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),i("#layui-layer-shade"+e.index).css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||settimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerwidth()),o.outerwidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeattr("layer").show(),n=null})},s.pt.ie6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc="function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var" a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.."+l[6]).outerheight(),s===o.type[2]?a.find("iframe").css({height:parsefloat(t.height)-f-c}):r.css({height:parsefloat(t.height)-f-c-parsefloat(r.css("padding-top"))-parsefloat(r.css("padding-bottom"))}))},r.min=function(e,t){var" a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeclass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("isOutAnim")&&t.addClass("layer-anim "+a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),r.ie&&r.ie<10||!t.data("isoutanim")?f():settimeout(function(){f()},200)}},r.closeall=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(e){s=e.find(".layui-layer-input"),s.focus(),"function"==typeof f&&f(e)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
    '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
  • '+(t[0].content||"no content")+"
  • ";i'+(t[i].content||"no content")+"";return a}()+"
",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgindex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgindex++,s.imgindex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]
'+(u.length>1?'':"")+'
"+s.imgIndex+"/"+u.length+"
",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); \ No newline at end of file +/*! layer-v3.5.1 Web 通用弹出层组件 MIT License */ + ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var t=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}(),i=e.LAYUI_GLOBAL||{};return i.layer_dir||t.substring(0,t.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c="creating",u=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function d(t){var n=100,a=document.getElementById(f);return++u>1e4/n?e.console&&console.error(l+".css: Invalid"):void(1989===parseInt(o.getStyle(a,"width"))?(t===c&&a.removeAttribute("lay-status"),a.getAttribute("lay-status")===c?setTimeout(d,n):i()):(a.setAttribute("lay-status",c),setTimeout(function(){d(c)},n)))}()}}},r={v:"3.5.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:260},n))}},s=function(e){var t=this,a=function(){t.creat()};t.index=++r.index,t.config.maxWidth=i(n).width()-30,t.config=i.extend({},t.config,o.config,e),document.body?a():setTimeout(function(){a()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],l.SHADE="layui-layer-shade",l.MOVE="layui-layer-move",s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,minStack:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
'+(f?r.title[0]:r.title)+"
":"";return r.zIndex=s,t([r.shade?'
':"",'
'+(e&&2!=r.type?"":u)+'
'+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
'+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
'+e+"
"}():"")+(r.resize?'':"")+"
"],u,i('
')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"","auto"];t.content='[フレーム]';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i("#"+l.MOVE)[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),e.shadeo=i("#"+l.SHADE+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),e.shadeo.css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():function(){e.offset(),parseInt(o.getStyle(document.getElementById(l.MOVE),"z-index"))||function(){e.layero.css("visibility","hidden"),r.ready(function(){e.offset(),e.layero.css("visibility","visible")})}()}(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||settimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerwidth()),o.outerwidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&t.shadeo.on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n,t.index);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n,t.index)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n,t.index)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeattr("layer").show(),n=null})},s.pt.ie6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc="function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var" a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.."+l[6]).outerheight(),s===o.type[2]?a.find("iframe").css({height:parsefloat(t.height)-f-c}):r.css({height:parsefloat(t.height)-f-c-parsefloat(r.css("padding-top"))-parsefloat(r.css("padding-bottom"))}))},r.min=function(e,t){t=t||{};var" a=i("#"+l[0]+e),s=i("#"+l.SHADE+e),f=a.find(l[1]).outerHeight()||0,c=a.attr("minLeft")||181*o.minIndex+"px",u=a.css("position"),d={width:180,height:f,position:"fixed",overflow:"hidden"};o.record(a),o.minLeft[0]&&(c=o.minLeft[0],o.minLeft.shift()),t.minStack&&(d.left=c,d.top=n.height()-f,a.attr("minLeft")||o.minIndex++,a.attr("minLeft",c)),a.attr("position",u),r.style(e,d,!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),s.hide()},r.restore=function(e){var t=i("#"+l[0]+e),n=i("#"+l.SHADE+e),a=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(a[0]),height:parseFloat(a[1]),top:parseFloat(a[2]),left:parseFloat(a[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e),n.show()},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e,t){var n=i("#"+l[0]+e),a=n.attr("type"),s="layer-anim-close";if(n[0]){var f="layui-layer-wrap",c=function(){if(a===o.type[1]&&"object"===n.attr("conType")){n.children(":not(."+l[5]+")").remove();for(var r=n.find("."+f),s=0;s<2;s++)r.unwrap();r.css("display",r.data("display")).removeclass(f)}else{if(a===o.type[2])try{var c=i("#"+l[4]+e)[0];c.contentWindow.document.write(""),c.contentWindow.close(),n.find("."+l[5])[0].removeChild(c)}catch(u){}n[0].innerHTML="",n.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e],"function"==typeof t&&t()};n.data("isOutAnim")&&n.addClass("layer-anim "+s),i("#layui-layer-moves, #"+l.SHADE+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),n.attr("minLeft")&&(o.minIndex--,o.minLeft.push(n.attr("minLeft"))),r.ie&&r.ie<10||!n.data("isoutanim")?c():settimeout(function(){c()},200)}},r.closeall=function(e,t){"function"==typeof e&&(t=e,e=null);var n=i("."+l[0]);i.each(n,function(a){var o=i(this),s=e?o.attr("type")===e:1;s&&r.close(o.attr("times"),a===n.length-1?t:null),s=null}),0===n.length&&"function"==typeof t&&t()};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
    '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
  • '+(t[0].content||"no content")+"
  • ";i'+(t[i].content||"no content")+"";return a}()+"
",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=!("string"==typeof t.photos||t.photos instanceof i),f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){h();var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0)}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgindex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgindex++,s.imgindex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev(!0)}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext(!0)}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),a&&(t.anim=-1),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+function(){return u.length>1?'
"+s.imgIndex+" / "+u.length+"
":""}()+"",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){r.ready(),o.run(e.jQuery)}()}(window); \ No newline at end of file diff --git a/dist/mobile/layer.js b/dist/mobile/layer.js index f9cf6931..46d22550 100644 --- a/dist/mobile/layer.js +++ b/dist/mobile/layer.js @@ -1,2 +1,2 @@ -/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */ +/*! layer mobile-v2.0.0 Web 通用弹出层组件 MIT License */ ;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'

'+(e?n.title[0]:n.title)+"

":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e=''+n.btn[0]+"",2===t&&(e=''+n.btn[1]+""+e),'
'+e+"
"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='

'+(n.content||"")+"

"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"
':"")+'
"+l+'
'+n.content+"
"+c+"
",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n ;', {pkg: pkg})) + return gulp.src('./src/layer.js').pipe(uglify({ + output: { + ascii_only: true //escape Unicode characters in strings and regexps + } + })) + .pipe(header('/*! <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License */\n ;', {pkg: pkg})) .pipe(gulp.dest('./dist')); } ,mobile: function() { - return gulp.src('./src/mobile/layer.js').pipe(uglify()) - .pipe(header('/*! <%= pkg.realname %> mobile-v<%= pkg.mobile %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %>mobile By <%= pkg.author %> */\n ;', {pkg: pkg})) + return gulp.src('./src/mobile/layer.js').pipe(uglify({ + output: { + ascii_only: true //escape Unicode characters in strings and regexps + } + })) + .pipe(header('/*! <%= pkg.realname %> mobile-v<%= pkg.mobile %> <%= pkg.description %> <%= pkg.license %> License */\n ;', {pkg: pkg})) .pipe(gulp.dest('./dist/mobile')); } ,other: function(){ @@ -43,21 +51,24 @@ gulp.task('layer', task.minjs); //压缩PC版本 gulp.task('mobile', task.mincss); //压缩Mobile文件 gulp.task('other', task.other); //移动一些配件 -//打包发行版 +//发行版本目录 var releaseDir = './release/zip/layer-v' + pkg.version; +var release = releaseDir + '/layer'; + +//打包发行版 gulp.task('clearZip', function(cb){ //清理 - return del(['./release/zip/*'], cb); + return del([releaseDir], cb); }); gulp.task('r', ['clearZip'], function(){ gulp.src('./release/doc/**/*') - .pipe(gulp.dest(releaseDir)) + .pipe(gulp.dest(releaseDir)); return gulp.src([ './dist/**/*' ,'!./dist/**/moon' ,'!./dist/**/moon/*' ]) - .pipe(gulp.dest(releaseDir + '/layer')) + .pipe(gulp.dest(release)); }); //全部 diff --git a/package.json b/package.json index 4f3e7c66..7b0f29ac 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "layui-layer", + "name": "layer-src", "realname": "layer", - "version": "3.1.1", + "version": "3.5.1", "mobile": "2.0.0", - "description": "Web弹层组件", + "description": "Web 通用弹出层组件", "main": "src/layer.js", "license": "MIT", "scripts": { @@ -13,8 +13,6 @@ "type": "https", "url": "git+https://github.com/sentsin/layer.git" }, - "author": "贤心", - "homepage": "http://layer.layui.com/", "devDependencies": { "gulp": "^3.9.0", "gulp-minify-css": "^1.2.4", @@ -31,6 +29,7 @@ }, "dependencies": {}, "keywords": [ + "layui", "layer", "dialog", "tips", diff --git a/src/README.md b/src/README.md index 767be26f..f9a84aae 100644 --- a/src/README.md +++ b/src/README.md @@ -1,3 +1,3 @@ ## 注意 -开发版源码随时可能会提交,因此生产环境更建议build目录中压缩后的layer.js。 \ No newline at end of file +开发版源码随时可能会提交,因此生产环境更建议 dist 目录中压缩后的 layer.js。 \ No newline at end of file diff --git a/src/layer.js b/src/layer.js index e906069e..9c753518 100644 --- a/src/layer.js +++ b/src/layer.js @@ -1,10 +1,7 @@ -/** - @Name:layer v3.1.1 Web弹层组件 - @Author:贤心 - @Site:http://layer.layui.com - @License:MIT - +/*! + * layer - 通用 Web 弹出层组件 + * MIT Licensed */ ;!function(window, undefined){ @@ -23,8 +20,9 @@ var isLayui = window.layui && layui.define, ,ドル win, ready = { } } return src || js[last].src; - }(); - return jsPath.substring(0, jsPath.lastIndexOf('/') + 1); + }() + ,GLOBAL = window.LAYUI_GLOBAL || {}; + return GLOBAL.layer_dir || jsPath.substring(0, jsPath.lastIndexOf('/') + 1); }(), config: {}, end: {}, minIndex: 0, minLeft: [], @@ -39,16 +37,20 @@ var isLayui = window.layui && layui.define, ,ドル win, ready = { return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name); }, - //载入CSS配件 + //载入 CSS 依赖 link: function(href, fn, cssname){ - //未设置路径,则不主动加载css if(!layer.path) return; - var head = document.getElementsByTagName("head")[0], link = document.createElement('link'); + var head = document.getElementsByTagName("head")[0] + ,link = document.createElement('link'); + if(typeof fn === 'string') cssname = fn; + var app = (cssname || href).replace(/\.|\//g, ''); - var id = 'layuicss-'+ app, timeout = 0; + var id = 'layuicss-'+ app + ,STAUTS_NAME = 'creating' + ,timeout = 0; link.rel = 'stylesheet'; link.href = layer.path + href; @@ -57,22 +59,41 @@ var isLayui = window.layui && layui.define, ,ドル win, ready = { if(!document.getElementById(id)){ head.appendChild(link); } - + if(typeof fn !== 'function') return; - - //轮询css是否加载完毕 - (function poll() { - if(++timeout> 8 * 1000 / 100){ - return window.console && console.error('layer.css: Invalid'); + + //轮询 css 是否加载完毕 + (function poll(status) { + var delay = 100 + ,getLinkElem = document.getElementById(id); //获取动态插入的 link 元素 + + //如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范 + if(++timeout> 10 * 1000 / delay){ + return window.console && console.error(app +'.css: Invalid'); }; - parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100); + + //css 加载就绪 + if(parseInt(ready.getStyle(getLinkElem, 'width')) === 1989){ + //如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态 + if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status'); + //如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调 + getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn(); + } else { + getLinkElem.setAttribute('lay-status', STAUTS_NAME); + setTimeout(function(){ + poll(STAUTS_NAME); + }, delay); + } + + //parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 1000); }()); + } }; //默认内置方法。 var layer = { - v: '3.1.1', + v: '3.5.1', ie: function(){ //ie版本 var agent = navigator.userAgent.toLowerCase(); return (!!window.ActiveXObject || "ActiveXObject" in window) ? ( @@ -87,6 +108,7 @@ var layer = { layer.path = ready.config.path || layer.path; typeof options.extend === 'string' && (options.extend = [options.extend]); + //如果设置了路径,则加载样式 if(ready.config.path) layer.ready(); if(!options.extend) return this; @@ -175,17 +197,20 @@ var layer = { shade: false, resize: false, fixed: false, - maxWidth: 210 + maxWidth: 260 }, options)); } }; var Class = function(setings){ - var that = this; + var that = this, creat = function(){ + that.creat(); + }; that.index = ++layer.index; + that.config.maxWidth = $(win).width() - 15*2; //初始最大宽度:当前屏幕宽,左右留 15px 边距 that.config = $.extend({}, that.config, ready.config, setings); - document.body ? that.creat() : setTimeout(function(){ - that.creat(); + document.body ? creat() : setTimeout(function(){ + creat(); }, 30); }; @@ -195,6 +220,9 @@ Class.pt = Class.prototype; var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close']; doms.anim = ['layer-anim-00', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06']; +doms.SHADE = 'layui-layer-shade'; +doms.MOVE = 'layui-layer-move'; + //默认配置 Class.pt.config = { type: 0, @@ -209,7 +237,8 @@ Class.pt.config = { zIndex: 19891014, maxWidth: 360, anim: 0, - isOutAnim: true, + isOutAnim: true, //退出动画 + minStack: true, //最小化堆叠 icon: -1, moveType: 1, resize: true, @@ -229,10 +258,10 @@ Class.pt.vessel = function(conType, callback){ config.zIndex = zIndex; callback([ //遮罩 - config.shade ? ('
') : '', + config.shade ? ('
') : '', //主体 - '
' + '
' + (conType && config.type != 2 ? '' : titleHTML) + '
' + (config.type == 0 && config.icon !== -1 ? '' : '') @@ -253,7 +282,7 @@ Class.pt.vessel = function(conType, callback){ }() : '') + (config.resize ? '' : '') + '
' - ], titleHTML, $('')); + ], titleHTML, $('
')); return that; }; @@ -287,7 +316,7 @@ Class.pt.creat = function(){ layer.closeAll('dialog'); break; case 2: - var content = config.content = conType ? config.content : [config.content||'http://layer.layui.com', 'auto']; + var content = config.content = conType ? config.content : [config.content||'', 'auto']; config.content = '[フレーム]'; break; case 3: @@ -319,21 +348,36 @@ Class.pt.creat = function(){ } }(); }() : body.append(html[1]); - $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem); + $('#'+ doms.MOVE)[0] || body.append(ready.moveElem = moveElem); + that.layero = $('#'+ doms[0] + times); + that.shadeo = $('#'+ doms.SHADE + times); + config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times); }).auto(times); //遮罩 - $('#layui-layer-shade'+ that.index).css({ + that.shadeo.css({ 'background-color': config.shade[1] || '#000' - ,'opacity': config.shade[0]||config.shade + ,'opacity': config.shade[0] || config.shade }); config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]); //坐标自适应浏览器窗口尺寸 - config.type == 4 ? that.tips() : that.offset(); + config.type == 4 ? that.tips() : function(){ + that.offset() + //首次弹出时,若 css 尚未加载,则等待 css 加载完毕后,重新设定尺寸 + parseInt(ready.getStyle(document.getElementById(doms.MOVE), 'z-index')) || function(){ + that.layero.css('visibility', 'hidden'); + layer.ready(function(){ + that.offset(); + that.layero.css('visibility', 'visible'); + }); + }(); + }(); + + //如果是固定定位 if(config.fixed){ win.on('resize', function(){ that.offset(); @@ -343,7 +387,7 @@ Class.pt.creat = function(){ } config.time <= 0 || setTimeout(function(){ - layer.close(that.index) + layer.close(that.index); }, config.time); that.move().callback(); @@ -663,26 +707,26 @@ Class.pt.callback = function(){ //点遮罩关闭 if(config.shadeClose){ - $('#layui-layer-shade'+ that.index).on('click', function(){ + that.shadeo.on('click', function(){ layer.close(that.index); }); } //最小化 layero.find('.layui-layer-min').on('click', function(){ - var min = config.min && config.min(layero); - min === false || layer.min(that.index, config); + var min = config.min && config.min(layero, that.index); + min === false || layer.min(that.index, config); }); //全屏/还原 layero.find('.layui-layer-max').on('click', function(){ if($(this).hasClass('layui-layer-maxmin')){ layer.restore(that.index); - config.restore && config.restore(layero); + config.restore && config.restore(layero, that.index); } else { layer.full(that.index, config); setTimeout(function(){ - config.full && config.full(layero); + config.full && config.full(layero, that.index); }, 100); } }); @@ -729,6 +773,7 @@ Class.pt.openLayer = function(){ }; }; +//记录宽高坐标,用于还原 ready.record = function(layero){ var area = [ layero.width(), @@ -823,11 +868,20 @@ layer.style = function(index, options, limit){ //最小化 layer.min = function(index, options){ + options = options || {}; var layero = $('#'+ doms[0] + index) + ,shadeo = $('#'+ doms.SHADE + index) ,titHeight = layero.find(doms[1]).outerHeight() || 0 ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px' - ,position = layero.css('position'); + ,position = layero.css('position') + ,settings = { + width: 180 + ,height: titHeight + ,position: 'fixed' + ,overflow: 'hidden' + }; + //记录宽高坐标,用于还原 ready.record(layero); if(ready.minLeft[0]){ @@ -835,31 +889,33 @@ layer.min = function(index, options){ ready.minLeft.shift(); } - layero.attr('position', position); + //是否堆叠在左下角 + if(options.minStack){ + settings.left = left; + settings.top = win.height() - titHeight; + layero.attr('minLeft') || ready.minIndex++; //初次执行,最小化操作索引自增 + layero.attr('minLeft', left); + } - layer.style(index, { - width: 180 - ,height: titHeight - ,left: left - ,top: win.height() - titHeight - ,position: 'fixed' - ,overflow: 'hidden' - }, true); + layero.attr('position', position); + layer.style(index, settings, true); layero.find('.layui-layer-min').hide(); layero.attr('type') === 'page' && layero.find(doms[4]).hide(); ready.rescollbar(index); - - if(!layero.attr('minLeft')){ - ready.minIndex++; - } - layero.attr('minLeft', left); + + //隐藏遮罩 + shadeo.hide(); }; //还原 layer.restore = function(index){ - var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(','); - var type = layero.attr('type'); + var layero = $('#'+ doms[0] + index) + ,shadeo = $('#'+ doms.SHADE + index) + ,area = layero.attr('area').split(',') + ,type = layero.attr('type'); + + //恢复原来尺寸 layer.style(index, { width: parseFloat(area[0]), height: parseFloat(area[1]), @@ -868,10 +924,14 @@ layer.restore = function(index){ position: layero.attr('position'), overflow: 'visible' }, true); + layero.find('.layui-layer-max').removeClass('layui-layer-maxmin'); layero.find('.layui-layer-min').show(); layero.attr('type') === 'page' && layero.find(doms[4]).show(); ready.rescollbar(index); + + //恢复遮罩 + shadeo.show(); }; //全屏 @@ -901,7 +961,7 @@ layer.title = function(name, index){ }; //关闭layer总方法 -layer.close = function(index){ +layer.close = function(index, callback){ var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close'; if(!layero[0]) return; var WRAP = 'layui-layer-wrap', remove = function(){ @@ -927,13 +987,14 @@ layer.close = function(index){ } typeof ready.end[index] === 'function' && ready.end[index](); delete ready.end[index]; + typeof callback === 'function' && callback(); }; if(layero.data('isOutAnim')){ layero.addClass('layer-anim '+ closeAnim); } - $('#layui-layer-moves, #layui-layer-shade' + index).remove(); + $('#layui-layer-moves, #'+ doms.SHADE + index).remove(); layer.ie == 6 && ready.reselect(); ready.rescollbar(index); if(layero.attr('minLeft')){ @@ -951,18 +1012,24 @@ layer.close = function(index){ }; //关闭所有层 -layer.closeAll = function(type){ - $.each($('.'+doms[0]), function(){ +layer.closeAll = function(type, callback){ + if(typeof type === 'function'){ + callback = type; + type = null; + }; + var domsElem = $('.'+doms[0]); + $.each(domsElem, function(_index){ var othis = $(this); var is = type ? (othis.attr('type') === type) : 1; - is && layer.close(othis.attr('times')); + is && layer.close(othis.attr('times'), _index === domsElem.length - 1 ? callback : null); is = null; }); + if(domsElem.length === 0) typeof callback === 'function' && callback(); }; /** - 拓展模块,layui开始合并在一起 + 拓展模块,layui 开始合并在一起 */ @@ -982,8 +1049,8 @@ layer.prompt = function(options, yes){ style = '+ area[0] +'; height: '+ area[1] + ';"'; delete options.area; } - var prompt, content = options.formType == 2 ? '' : function(){ - return ''; + var prompt, content = options.formType == 2 ? '' : function(){ + return ''; }(); var success = options.success; @@ -997,7 +1064,7 @@ layer.prompt = function(options, yes){ ,maxWidth: win.width() ,success: function(layero){ prompt = layero.find('.layui-layer-input'); - prompt.focus(); + prompt.val(options.value || '').focus(); typeof success === 'function' && success(layero); } ,resize: false @@ -1068,17 +1135,21 @@ layer.photos = function(options, loop, key){ var dict = {}; options = options || {}; if(!options.photos) return; - var type = options.photos.constructor === Object; - var photos = type ? options.photos : {}, data = photos.data || []; - var start = photos.start || 0; - dict.imgIndex = (start|0) + 1; + //若 photos 并非选择器或 jQuery 对象,则为普通 object + var isObject = !(typeof options.photos === 'string' || options.photos instanceof $) + ,photos = isObject ? options.photos : {} + ,data = photos.data || [] + ,start = photos.start || 0; + + dict.imgIndex = (start|0) + 1; options.img = options.img || 'img'; var success = options.success; delete options.success; - - if(!type){ //页面直接获取 + + //如果 options.photos 不是一个对象 + if(!isObject){ //页面直接获取 var parent = $(options.photos), pushData = function(){ data = []; parent.find(options.img).each(function(index){ @@ -1090,7 +1161,7 @@ layer.photos = function(options, loop, key){ src: othis.attr('layer-src') || othis.attr('src'), thumb: othis.attr('src') }); - }) + }); }; pushData(); @@ -1098,6 +1169,7 @@ layer.photos = function(options, loop, key){ if (data.length === 0) return; loop || parent.on('click', options.img, function(){ + pushData(); var othis = $(this), index = othis.attr('layer-index'); layer.photos($.extend(options, { photos: { @@ -1107,8 +1179,7 @@ layer.photos = function(options, loop, key){ }, full: options.full }), true); - pushData(); - }) + }); //不直接弹出 if(!loop) return; @@ -1164,20 +1235,22 @@ layer.photos = function(options, loop, key){ //一些动作 dict.event = function(){ + /* dict.bigimg.hover(function(){ dict.imgsee.show(); }, function(){ dict.imgsee.hide(); }); + */ dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){ event.preventDefault(); - dict.imgprev(); + dict.imgprev(true); }); dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){ event.preventDefault(); - dict.imgnext(); + dict.imgnext(true); }); $(document).on('keyup', dict.keyup); @@ -1207,6 +1280,11 @@ layer.photos = function(options, loop, key){ loadImage(data[start].src, function(img){ layer.close(dict.loadi); + + //切换图片时不出现动画 + if(key) options.anim = -1; + + //弹出图片层 dict.index = layer.open($.extend({ type: 1, id: 'layui-layer-photos', @@ -1236,19 +1314,24 @@ layer.photos = function(options, loop, key){ moveType: 1, scrollbar: false, moveOut: true, - //anim: Math.random()*5|0, + anim: 5, isOutAnim: false, skin: 'layui-layer-photos' + skin('photos'), content: '
' +''+ (data[start].alt||'') +'' - +'
' - +(data.length> 1 ? '' : '') - +'
'+ dict.imgIndex +'/'+ data.length +'
' - +'
' + +function(){ + if(data.length> 1){ + return '
' + +'' + +'
'+ dict.imgIndex +' / '+ data.length +'
' + +'
' + } + return ''; + }() +'
', success: function(layero, index){ dict.bigimg = layero.find('.layui-layer-phimg'); - dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar'); + dict.imgsee = layero.find('.layui-layer-imgbar'); dict.event(layero); options.tab && options.tab(data[start], layero); typeof success === 'function' && success(layero); @@ -1283,7 +1366,7 @@ ready.run = function(_$){ //加载方式 window.layui && layui.define ? ( layer.ready() - ,layui.define('jquery', function(exports){ //layui加载 + ,layui.define('jquery', function(exports){ //layui 加载 layer.path = layui.cache.dir; ready.run(layui.$); @@ -1292,13 +1375,16 @@ window.layui && layui.define ? ( exports('layer', layer); }) ) : ( - (typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs加载 + (typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs 加载 ready.run(window.jQuery); return layer; - }) : function(){ //普通script标签加载 - ready.run(window.jQuery); + }) : function(){ //普通 script 标签加载 layer.ready(); + ready.run(window.jQuery); }() ); }(window); + + + diff --git a/src/mobile/layer.js b/src/mobile/layer.js index 1d97d9ee..23116171 100644 --- a/src/mobile/layer.js +++ b/src/mobile/layer.js @@ -2,8 +2,7 @@ @Name:layer mobile v2.0 弹层组件移动版 @Author:贤心 - @Site:http://layer.layui.com/mobie/ - @License:LGPL + @License:MIT */ diff --git a/src/theme/default/layer.css b/src/theme/default/layer.css index 73d7eb23..54a6aeee 100644 --- a/src/theme/default/layer.css +++ b/src/theme/default/layer.css @@ -1,7 +1,6 @@ /** @Name: layer - @Author: 贤心 **/ @@ -51,8 +50,8 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;} @-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:42px; line-height:42px; border-bottom:1px solid #eee; font-size:14px; color:#333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background-color: #F8F8F8; border-radius: 2px 2px 0 0;} -.layui-layer-setwin{position:absolute; right:15px; *right:0; top:15px; font-size:0; line-height: initial;} +.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: 17px; font-size:0; line-height: initial;} .layui-layer-setwin a{position:relative; width: 16px; height:16px; margin-left:10px; font-size:12px; _overflow:hidden;} .layui-layer-setwin .layui-layer-min cite{position:absolute; width:14px; height:2px; left:0; top:50%; margin-top:-1px; background-color:#2E2D3C; cursor:pointer; _overflow:hidden;} .layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA; } @@ -75,7 +74,7 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;} .layui-layer-btn-c{text-align: center;} /* 定制化 */ -.layui-layer-dialog{min-width:260px;} +.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-ico{position:absolute; top:16px; left:15px; _left:-40px; width:30px; height:30px;} .layui-layer-ico1{background-position:-30px 0 } @@ -129,7 +128,7 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;} .layui-layer-iconext{background:url(icon-ext.png) no-repeat;} /* prompt模式 */ -.layui-layer-prompt .layui-layer-input{display: block; width: 230px; height: 36px; margin: 0 auto; line-height: 30px; padding-left: 10px; border: 1px solid #e6e6e6; color: #333;} +.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;} @@ -137,24 +136,23 @@ html #layuicss-layer{display: none; position: absolute; width: 1989px;} /* 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:260px; 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: 43px; border-left: 1px solid #eee; border-right: 1px solid #eee; background-color: #fff; z-index: 10;} +.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{-webkit-animation-duration: .8s; animation-duration: .8s;} +.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-imguide,.layui-layer-imgbar{display:none;} -.layui-layer-imgprev, .layui-layer-imgnext{position:absolute; top:50%; width:27px; _width:44px; height:44px; margin-top:-22px; outline:none;blr:expression(this.onFocus=this.blur());} -.layui-layer-imgprev{left:10px; background-position:-5px -5px; _background-position:-70px -5px;} +.layui-layer-imgprev, .layui-layer-imgnext{position: fixed; top: 50%; width: 27px; _width: 44px; height: 44px; margin-top:-22px; outline:none;blr:expression(this.onFocus=this.blur());} +.layui-layer-imgprev{left: 30px; background-position:-5px -5px; _background-position:-70px -5px;} .layui-layer-imgprev:hover{background-position:-33px -5px; _background-position:-120px -5px;} -.layui-layer-imgnext{right:10px; _right:8px; background-position:-5px -50px; _background-position:-70px -50px;} -.layui-layer-imgnext:hover{background-position:-33px -50px; _background-position:-120px -50px;} -.layui-layer-imgbar{position:absolute; left:0; bottom:0; width:100%; height:32px; line-height:32px; background-color:rgba(0,0,0,.8); background-color:#0009円; filter:Alpha(opacity=80); color:#fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;} +.layui-layer-imgnext{right: 30px; _right:8px; background-position:-5px -50px; _background-position:-70px -50px;} +.layui-layer-imgnext:hover{background-position: -33px -50px; _background-position: -120px -50px;} +.layui-layer-imgbar{position: fixed; left:0; right: 0; bottom:0; width:100%; height: 40px; line-height: 40px; background-color:#0009円; 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;} diff --git a/test/demo.html b/test/demo.html index 1ce71e41..d091df12 100644 --- a/test/demo.html +++ b/test/demo.html @@ -26,25 +26,24 @@
- @Name:layer-v 弹层组件说明
- @Author:贤心
- @Site:http://layer.layui.com/
+ @Name:layer
+ @Version:v
+ @Description:通用 Web 弹层组件
 
 
 【注意事项】
-一、使用时,请把文件夹layer整个放置在您站点的任何一个目录,只需引入layer.js即可,除jQuery外,其它文件无需再引入。
-二、如果您的js引入是通过合并处理或者您不想采用layer自动获取的绝对路径,您可以通过layer.config()来配置(详见官网API页)
-三、jquery需1.8+
-四、更多使用说明与演示,请参见layer官网。
-五、使用时请务必保留来源,请勿用于违反我国法律法规的web平台。
-六、layer遵循MIT开源协议,将永久性提供无偿服务。
+一、使用时,请把文件夹 layer 整个放置在您站点的任何一个目录,只需引入 layer.js 即可,除 jQuery 外,其它文件无需再引入。
+二、如果您的 js 引入是通过合并处理或者您不想采用layer自动获取的绝对路径,您可以通过 layer.config() 来配置(详见官网 API 页)
+三、jQuery 需 1.8+
+四、更多使用说明与演示,请参见 layer 官网。
+五、使用时请务必保留来源,请勿用于违反我国法律法规的 Web 平台。
+六、layer 是一款无偿的公益性项目,遵循 MIT 开源协议。
 
@@ -68,7 +67,7 @@ //关于 $('#about').on('click', function(){ - layer.alert(layer.v + ' - 贤心出品 sentsin.com'); + layer.alert('layui 出品'); }); }();

AltStyle によって変換されたページ (->オリジナル) /