layui的弹窗


参考http://www.uimaker.com/layui/doc/modules/layer.html,弹出层组件

1.jsp

class="layout-know-right">
class="publish" src="../imgs/publish.png"/>

2.js

function popDocAddUrl(t) {
    var obj = $(t);
    var url = obj.attr("link");
    if (url) {
        obj.attr('link', 'javascript:void(0);');
        var width = obj.attr('w') ? obj.attr("w") + 'px' : '1200px';
        var height = obj.attr('h') ? obj.attr("h") + 'px' : '95%';
        var offset = obj.attr("t") ? obj.attr("t") + 'px' : "auto";
        var title = obj.attr("title") ? obj.attr("title") : "知识发布";
        top.layer.open({
            type: 2,
            content: url,
            shadeClose: true,
            offset: offset,
            maxmin: true,
            title: title,
            area: [width, height],
            success: function (layero, index) {
                obj.attr('link', url);
            }, cancel: function (index, layero) {
                obj.attr('link', url);
            }
        });
    }
}

相关