乐趣区

layer-打开和关闭-通用函数

// 打开 layer 弹出框
// title:标题
// w:款
// h:高
// url:地址
openLayer(title,w,h,url){
    var dirname = window.location.origin;
    if (title == null || title == '') {title=false;};
    if (url == null || url == '') {url="404.html";};
    if (w == null || w == '') {w=800;};
    if (h == null || h == '') {h=($(window).height() - 50);
    };
    url =  dirname + url;
    console.log(url)
    layer.open({
        type: 2,
        title: title,
        shadeClose: true, // 点击遮罩关闭层
        area : [w+'px', h +'px'],
        content: url,
        scrollbar :true
    })
}


// 关闭 layer 弹出框
closeLayer(){var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}
退出移动版