原码笔记

原码笔记

layer移动端content自定义html方法

小诸哥 0

最近在写一个信息平台的页面,想用一些弹出层,但是呢写的不太熟练,所以想到了用layer移动端的弹出层

//页面层
layer.open({
type: 1
,content: '可传入任何内容,支持html。一般用于手机页面中'
,anim: 'up'
,style: 'position:fixed; bottom:0; left:0; width: 100%; height: 200px; padding:10px 0; border:none;'
});

上面是layer移动端页面层代码

复制过来之后想改变content中的内容代码如下

//页面层
layer.open({
type: 1
// ,content: $('#ChooseCategory').html()
,content: document.getElementById('ChooseCategory')[xss_clean]
,anim: 'up'
,style: 'position:fixed; bottom:0; left:0; width: 100%; height: 200px; padding:10px 0; border:none;'
});

上面注释掉那行是jquer的方法,如果没引用jquer之间用下面这行就可以

html部分的代码

<div  id="ChooseCategory" style="display: none">
<a style="color: cadetblue">123</a>
</div>

效果图:

标签: content