DWZ jui 动态添加a标签 弹框 不能用的处理方法

用动态方法添加了dom节点a标签属性为target="dialog" 后 发现点击 是直接是打开一个新的浏览器标签页 而不是我们想的一个弹框

我们这里处理的方法是 加一个新的js函数  在动态添加完之后 再调用这个js函数 

代码如下:

/*
 * ++ 自定义 再次初始dwz--dialog功能
 */
function reDialog_Dwz( _box ) {
    var $p = $(_box || document);

    $("a[target=dialog]", $p).each(function() {
        $(this).unbind('click');
    });
    $("a[target=dialog]", $p).each(function(){
        $(this).click(function(event){
            var $this = $(this);
            var title = $this.attr("title") || $this.text();
            var rel = $this.attr("rel") || "_blank";
            var options = {};
            var w = $this.attr("width");
            var h = $this.attr("height");
            if (w) options.width = w;
            if (h) options.height = h;
            options.max = eval($this.attr("max") || "false");
            options.mask = eval($this.attr("mask") || "false");
            options.maxable = eval($this.attr("maxable") || "true");
            options.minable = eval($this.attr("minable") || "true");
            options.fresh = eval($this.attr("fresh") || "true");
            options.resizable = eval($this.attr("resizable") || "true");
            options.drawable = eval($this.attr("drawable") || "true");
            options.close = eval($this.attr("close") || "");
            options.param = $this.attr("param") || "";

            var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first"));
            DWZ.debug(url);
            if (!url.isFinishedTm()) {
                alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg"));
                return false;
            }
            $.pdialog.open(url, rel, title, options);

            return false;
        });
    });
}

  

--------------------- 
作者:柒仔不安 
来源:CSDN 
原文:https://blog.csdn.net/yan263364/article/details/80509021 
版权声明:本文为博主原创文章,转载请附上博文链接!
原文地址:https://www.cnblogs.com/foreversun/p/11250593.html