layer弹窗

  1 <!doctype html>
  2 <html>
  3
  4 <head>
  5     <meta charset="utf-8">
  6     <title>layer-更懂你的web弹窗解决方案</title>
  7     <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
  8     <script src="layer/layer.js"></script>
  9     <script src="layer/extend/layer.ext.js"></script>
 10 </head>
 11
 12 <body>
 13     <script>
 14     function func1() {
 15         layer.alert(‘内容‘);
 16     }
 17
 18     function func2() {
 19         layer.alert(‘内容‘, {
 20             icon: 1,
 21             skin: ‘layer-ext-moon‘ //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则,去这里查阅
 22         });
 23     }
 24
 25     function func3() {
 26         //询问框
 27         layer.confirm(‘您是如何看待前端开发?‘, {
 28             btn: [‘重要‘,‘奇葩‘] //按钮
 29         }, function(){
 30             layer.msg(‘的确很重要‘, {icon: 1});
 31         }, function(){
 32             layer.msg(‘也可以这样‘, {
 33                 time: 2000, //2s后自动关闭
 34                 btn: [‘明白了‘, ‘知道了‘]
 35             });
 36         });
 37     }
 38
 39     function func4() {
 40         //提示层
 41         layer.msg(‘玩命提示中‘);
 42     }
 43
 44     function func5() {
 45         //墨绿深蓝风
 46         layer.alert(‘墨绿风格,点击确认看深蓝‘, {
 47             skin: ‘layui-layer-molv‘ //样式类名
 48             ,closeBtn: 0
 49         }, function(){
 50             layer.alert(‘偶吧深蓝style‘, {
 51                 skin: ‘layui-layer-lan‘
 52                 ,closeBtn: 0
 53                 ,shift: 4 //动画类型
 54             });
 55         });
 56     }
 57
 58     function func6() {
 59         //捕获页
 60         layer.open({
 61             type: 1,
 62             shade: false,
 63             title: false, //不显示标题
 64             content: $(‘.layer_notice‘), //捕获的元素
 65             cancel: function(index){
 66                 layer.close(index);
 67                 this.content.show();
 68                 layer.msg(‘捕获就是从页面已经存在的元素上,包裹layer的结构‘, {time: 2000, icon:6});
 69             }
 70         });
 71     }
 72
 73     function func7() {
 74         //页面层
 75         layer.open({
 76             type: 1,
 77             skin: ‘layui-layer-rim‘, //加上边框
 78             area: [‘420px‘, ‘240px‘], //宽高
 79             content: ‘html内容‘
 80         });
 81     }
 82
 83     function func8() {
 84         //自定页
 85         layer.open({
 86             type: 1,
 87             skin: ‘layui-layer-demo‘, //样式类名
 88             closeBtn: 0, //不显示关闭按钮
 89             shift: 2,
 90             area: [‘420px‘, ‘240px‘], //宽高
 91             shadeClose: true, //开启遮罩关闭
 92             content: ‘内容‘
 93         });
 94     }
 95
 96     function func9() {
 97         //tips层
 98         layer.tips(‘Hi,我是tips‘, $("#tips"));
 99     }
100
101     function func10() {
102         //iframe层
103         layer.open({
104             type: 2,
105             title: ‘layer mobile页‘,
106             shadeClose: true,
107             shade: 0.8,
108             area: [‘380px‘, ‘90%‘],
109             content: ‘http://m.baidu.com‘ //iframe的url
110         });
111     }
112
113     function func11() {
114         //iframe窗
115         layer.open({
116             type: 2,
117             title: false,
118             closeBtn: 0, //不显示关闭按钮
119             shade: [0],
120             area: [‘340px‘, ‘215px‘],
121             offset: ‘auto‘, //右下角弹出
122             time: 2000, //2秒后自动关闭
123             shift: 2,
124             content: [‘test/guodu.html‘, ‘no‘], //iframe的url,no代表不显示滚动条
125             end: function(){ //此处用于演示
126                 layer.open({
127                     type: 2,
128                     title: ‘百度一下,你就知道‘,
129                     shadeClose: true,
130                     shade: false,
131                     maxmin: true, //开启最大化最小化按钮
132                     area: [‘1150px‘, ‘650px‘],
133                     content: ‘http://www.baidu.com‘
134                 });
135             }
136         });
137     }
138
139     function func12() {
140         //加载层
141         var index = layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
142     }
143
144     function func13() {
145         //loading层
146         var index = layer.load(1, {
147             shade: [0.1,‘#fff‘] //0.1透明度的白色背景
148         });
149     }
150
151     function func14() {
152         //小tips
153         layer.tips(‘我是另外一个tips,只不过我长得跟之前那位稍有些不一样。‘, $(‘#tips2‘), {
154             tips: [1, ‘#3595CC‘],
155             time: 4000
156         });
157     }
158
159     function func15() {
160
161         //prompt层
162         layer.prompt({
163             title: ‘输入任何口令,并确认‘,
164             formType: 1 //prompt风格,支持0-2
165         }, function(pass){
166             layer.prompt({title: ‘随便写点啥,并确认‘, formType: 2}, function(text){
167                 layer.msg(‘演示完毕!您的口令:‘+ pass +‘ 您最后写下了:‘+ text);
168             });
169         });
170     }
171
172     function func16() {
173         //tab层
174         layer.tab({
175             area: [‘600px‘, ‘300px‘],
176             tab: [{
177                 title: ‘TAB1‘,
178                 content: ‘内容1‘
179             }, {
180                 title: ‘TAB2‘,
181                 content: ‘内容2‘
182             }, {
183                 title: ‘TAB3‘,
184                 content: ‘内容3‘
185             }]
186         });
187     }
188
189
190     function openpage() {
191         layer.config({
192             extend: ‘extend/layer.ext.js‘
193         });
194         //页面一打开就执行,放入ready是为了layer所需配件(css、扩展模块)加载完毕
195         layer.ready(function() {
196             //官网欢迎页
197             layer.open({
198                 type: 2,
199                 skin: ‘layui-layer-lan‘,
200                 title: ‘layer弹层组件‘,
201                 fix: false,
202                 shadeClose: true,
203                 maxmin: true,
204                 area: [‘1000px‘, ‘500px‘],
205                 content: ‘https://www.baidu.com‘
206             });
207             layer.msg(‘欢迎使用layer‘);
208         });
209     }
210     </script>
211
212     <div class="layer_notice">hello,i‘m layer!</div>
213     <button id="func1" onclick="func1();">初体验</button>
214     <button id="func2" onclick="func2();">皮肤</button>
215     <button id="func3" onclick="func3();">询问框</button>
216     <button id="func4" onclick="func4();">提示层</button>
217     <button id="func5" onclick="func5();">蓝色风格</button>
218     <button id="func6" onclick="func6();">捕捉页</button>
219     <button id="func7" onclick="func7();">页面层</button>
220     <button id="func8" onclick="func8();">自定义</button>
221     <button id="func9" onclick="func9();">tips层</button>
222     <button id="func10" onclick="func10();">iframe层</button>
223     <button id="func11" onclick="func11();">iframe窗</button>
224     <button id="func12" onclick="func12();">加载层</button>
225     <button id="func13" onclick="func13();">loading层</button>
226     <button id="func14" onclick="func14();">小tips</button>
227     <button id="func15" onclick="func15();">prompt层</button>
228     <button id="func16" onclick="func16();">tab层</button>
229     <button id="openpage" onclick="openpage();">openpage</button>
230     <button id="tips">tips</button>
231     <button id="tips2">tips2</button>
232 </body>
233
234 </html>
时间: 2024-08-30 00:58:44

layer弹窗的相关文章

layer弹窗第二个按钮

layer弹窗组件,第二个按钮是btn2,第三个按钮是btn3.千万别当成no了.哈哈. layer.alert('确定删除吗?', { title: '提示', icon: 0 ,//0:感叹号 1:对号 2:差号 3:问号 4:小锁 5:哭脸 6:笑脸 time: 0 ,//不自动关闭 btn: ['YES', 'NO'], yes: function(index) { layer.close(index); layer.msg('正在删除中...'); }, btn2: function(

layer弹窗使用

代码&资源文件 layer弹窗使用.rar 1.文件目录 popup.html 2.引入资源文件 <script type="text/javascript" src="./src/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="./layer/layer.js"></script> 3

layer弹窗的跳转功能

1,本弹窗直接跳转父页面: 1 @if(session('message')) 2 3 <script> 4 window.parent.location.reload(); //刷新父页面 5 var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 6 parent.layer.close(index); // 关闭layer 7 </script> 8 @endif 2,点击关闭弹窗后刷新当前页面: 只需在弹窗

jquery layer弹窗弹层插件 小巧强大

/* 先去官网下载最新的js  http://sentsin.com/jquery/layer/ ①引用jquery ②引用layer.min.js */ 触发弹层的事件可自由绑定,如: $('#id').on('click', function(){ layer.msg('test'); }); 下面主要贴出上述例子的调用代码: [信息框]: layer.alert('白菜级别前端攻城师贤心', 8); //风格一 layer.msg('前端攻城师贤心'); //风格二 //当然,远远不止这两

jquery layer弹窗弹层插件 (转)

/* 先去官网下载最新的js  http://sentsin.com/jquery/layer/ ①引用jquery ②引用layer.min.js */ 触发弹层的事件可自由绑定,如: $('#id').on('click', function(){ layer.msg('test'); }); 下面主要贴出上述例子的调用代码: [信息框]: layer.alert('白菜级别前端攻城师贤心', 8); //风格一 layer.msg('前端攻城师贤心'); //风格二 //当然,远远不止这两

layer弹窗确定按钮:父页面调用子页面

实例: var index=layer.open({         type:2,         title: '选择节点任务',         closeBtn: 1,         area:['300px','400px'],         shade:[0.5, '#000000'],         maxmin:false,         btn: ['确定', '关闭'],         yes: function(index, layero){          

【Thinkphp5】结合layer弹窗 定制操作结果页面

1 打开应用公共文件页面    appliction/common.php,编写以下代码 注意: 成功消息的绿色背景部分是iframe 框架写法,如果是普通页面.就吧parent去除,改为: self.location.href="'.$url.'" /** * $msg 待提示的消息 * $url 待跳转的链接 * $icon 这里主要有两个,5和6,代表两种表情(哭和笑) * $time 弹出维持时间(单位秒) */ function alert_success($msg='',$

layer弹窗插件自带自写经验

复制可下载源代码和自写教程    链接: https://pan.baidu.com/s/1mhHa5Os 密码: j5su

layer弹出层中H5播放器全屏出错解决 &amp; 属性poster底图占满video的方法

1. 在layer弹窗组件中 如果使用了flash播放器,全屏是正常的 但若使用了HTML5的播放器,全屏失效 举个栗子 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 <script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-