jquery的Layer弹出框操作

在layer中,我们要先获取窗口的索引,然后再进行操作。
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引

$("#update_id").click(function() { parent.$('#father_id').html(autoSelectName);//对父页面的元件操作,给id为father_id进行赋值。 window.parent.location.reload(); //刷新父页面 parent.layer.close(index); });
openUser是一个js方法,selectId,selectName是传的参数,里面调用layer的open方法,area是弹出框的大小,content是请求页面路径。
还要导入layer的js包,在layer的官网上可以下载,加载layer.js就行,注意,这个好像要求jquery的版本是1.8以上才行。
function
openUser(selectId,selectName){ layer.open({ type: 2, title: '选择关联人', maxmin: true, area: ['1000px', '600px'], content: '${base}/user/listLayout?selectId='+selectId+'&selectName='+selectName, scrollbar: false, end: function(){ } }); }


在layer的官网有很全的例子供大家学习,我觉得这个功能比较强大,当然如果要弄弹出层,也可以采用bootsrap的静态框。
layer的官网:http://layer.layui.com/
原文地址:https://www.cnblogs.com/TerLeeHost/p/7843398.html