文章目录

//信息框-例1
layer.alert(‘见到你真的很高兴’, {icon: 6});

//信息框-例2
layer.confirm(‘你确定你很帅么?’, {icon: 3}, function(index){
layer.close(index);
alert(
‘自恋狂’);
});

//信息框-例3
layer.msg(‘这是最常用的吧’);

//信息框-例4
layer.msg(‘不开心。。’, {icon: 5});

//信息框-例4
layer.msg(‘玩命卖萌中’, function(){
//关闭后的操作
});

//页面层-自定义
layer.open({
type:
1,
title:
false,
closeBtn:
false,
shadeClose:
true,
skin:
‘yourclass’,
content:
‘自定义HTML内容’
});

//页面层-佟丽娅
layer.open({
type:
1,
title:
false,
closeBtn:
false,
area:
‘516px’,
skin:
‘layui-layer-nobg’, //没有背景色
shadeClose: true,
content: $(
‘#tong’)
});

//iframe层-父子操作
layer.open({
type:
2,
area: [
‘700px’, ‘530px’],
fix:
false, //不固定
maxmin: true,
content:
‘test/iframe.html’
});

//iframe层-多媒体
layer.open({
type:
2,
title:
false,
area: [
‘630px’, ‘360px’],
shade:
0.8,
closeBtn:
false,
shadeClose:
true,
content:
http://player.youku.com/embed/XMjY3MzgzODg0
});
layer.msg(
‘点击遮罩任意处关闭’);

//iframe层-禁滚动条
layer.open({
type:
2,
area: [
‘360px’, ‘500px’],
skin:
‘layui-layer-rim’, //加上边框
content: [‘http://layer.layui.com/mobile‘, ‘no’]
});

//加载层-默认风格
layer.load();
//此处演示关闭
setTimeout(function(){
layer.closeAll(
‘loading’);
},
2000);

//加载层-风格2
layer.load(1);
//此处演示关闭
setTimeout(function(){
layer.closeAll(
‘loading’);
},
2000);

//加载层-风格3
layer.load(2);
//此处演示关闭
setTimeout(function(){
layer.closeAll(
‘loading’);
},
2000);

//加载层-风格4
layer.msg(‘加载中’, {icon: 16});

//打酱油
layer.msg(‘尼玛,打个酱油’, {icon: 4});

//tips层-上
layer.tips(‘上’, ‘#id或者.class’, {
tips: [
1, ‘#0FA6D8’] //还可配置颜色
});

//tips层-右
layer.tips(‘默认就是向右的’, ‘#id或者.class’);

//tips层-下
layer.tips(‘下’, ‘#id或者.class’, {
tips:
2
});

//tips层-左
layer.tips(‘左边么么哒’, ‘#id或者.class’, {
tips: [
4, ‘#78BA32’]
});

//tips层-不销毁之前的
layer.tips(‘不销毁之前的’, ‘#id或者.class’, {
tipsMore:
true
});

//默认prompt
layer.prompt(function(val){
layer.msg(
‘得到了’+val);
});

//屏蔽浏览器滚动条
layer.open({
content:
‘浏览器滚动条已锁’,
scrollbar:
false
});

//弹出即全屏
var index = layer.open({
type:
2,
content:
http://www.layui.com,
area: [
‘300px’, ‘195px’],
maxmin:
true
});
layer.full(index);

//正上方
layer.msg(‘灵活运用offset’, {
offset:
0,
shift:
6
});

//还该列举什么呢
layer.msg(‘等我想想…’);


 

案列实践


<a href=”<?= url(‘/user/edit/‘ . $val->id) ?>” class=”eve_edit” rel=”popup2” title=”会员资料修改” class=”poplight” >资料修改</a>
<a href=”<?= url(‘/user/frozen/‘ . $val->id ) ?>” title=”选择冻结项” class=”event_lock”>冻结</a>

js代码书写


 $(‘.eve_edit’).click(function() {
oplayer
= layer.open({
type:
2,
title: $(
this).attr(‘title’),
shadeClose:
true,
shade:
false,
maxmin:
true,
area: [
‘60%’, ‘80%’],
content: $(
this).attr(‘href’)
});
return false;
});

 

文章目录