js、jQuery、layer实现弹出层的打开、关闭

打开layer

 

layer.open({
   type: 2,
   title: '新增收货地址',
   shadeClose: true,//点击阴影关闭
   shade: 0.8,
   area: ['900px', '60%'],
   content: [Think.U('Home/UserAddress/addAddress')]
});

 

//捕获页
                  layer.open({
                      type: 1,
                      area: ["auto", "auto"],
                      shade: 0.3,//遮罩透明度,或false没有遮罩
                      title: false, //不显示标题
                      content: $('.user_info'), //捕获的元素,注意:最好该指定的元素要存放在body最外层,否则可能被其它的相对元素所影响
                      cancel: function () {
                          //layer.msg('捕获就是从页面已经存在的元素上,包裹layer的结构', { time: 5000, icon: 6 });
                      }
                  });

 

 

 

 

 

 

执行保存操作后关闭

 

$.post(Think.U('Home/UserAddress/edit'),params,function(data,textStatus){
   var json = GY.toJson(data);
   //alert(JSON.stringify(json));
if(json.status>0){
    parent.window.location.reload();
         var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
parent.layer.close(index);
}else{ }});

 


posted @ 2017-06-29 15:14  LIULIULIU666  阅读(5944)  评论(0编辑  收藏  举报