我一个页面有两个弹窗,其中一个没有关闭按钮
代码:
layer.open({
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['1000px', '700px'], //宽高
title: '帖子详情',
content: contents,
});
我一个页面有两个弹窗,其中一个没有关闭按钮
代码:
layer.open({
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['1000px', '700px'], //宽高
title: '帖子详情',
content: contents,
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="layui/css/modules/layer/default/layer.css"/>
<link rel="stylesheet" type="text/css" href="layui/css/layui.css"/>
<script src="https://cdn.bootcss.com/jquery/2.1.0/jquery.js"></script>
<script src="layui/lay/modules/layer.js">
</script>
</head>
<style type="text/css">
#our{
width: 200px;
height: 50px;
background: red;
}
#you{
width: 200px;
height: 50px;
background: blue;
}
</style>
<body>
<div id="our">
我们
</div>
<div id="you">
你们
</div>
</body>
</html>
<script type="text/javascript">
$("#our").on("click",function(){
layer.open({
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['1000px', '700px'], //宽高
title: '帖子详情',
content: "加油"
});
})
$("#you").on("click",function(){
layer.open({
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['1000px', '700px'], //宽高
title: '帖子详情',
content: "必胜"
});
})
</script>
添加基础参数就可以了,
layer.open({
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['1000px', '700px'], //宽高
title: '帖子详情',
content: contents,
closeBtn:1
});
layer提供了两种风格的关闭按钮,可通过配置1和2来展示,如果不显示,则closeBtn: 0
10 回答11.1k 阅读
6 回答3k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.6k 阅读✓ 已解决
3 回答5.1k 阅读✓ 已解决
5 回答1.9k 阅读
原因是我拼接contents的时候 '+=' 写成 '=' 了,所以才影响到了吧。修改过来后就可以了