如何在单击此树的任何项目时创建弹出窗口

时间:2015-12-09 13:15:45

标签: javascript jquery html css

当我点击树here

中的任何项目时,我想显示div

通过此iframe将树加载到index.html

<IFRAME NAME="treeframe" ID="treeframe" SRC="tree.htm?150921" CLASS="fullsize" FRAMEBORDER="0" SCROLLING="no"></IFRAME>

元素(&#39; .di&#39;) 是用js生成的

        var v = document.createElement("div");
    v.className = "di";
    var s = v.style;
    s.width = sz.Tew + "px";
    s.height = sh + "px";
    s.left = (sx - (sz.Tew / 2)) + "px";
    s.top = (sy - (sh / 2)) + "px";
    if (wp) {
        v.onmousedown = TCT;
        v.id = i;
        v.pid = e.p.i;
        o.ps[i] = {
            x: sx,
            y: sy
        };
    }
    var tn = e.p.hp ? (mn ? fn : (e.p.h + (sn ? (" " + sn) : ""))) : e.p.h;
    v.innerHTML = "<TABLE WIDTH=\"100%\" HEIGHT=\"100%\" STYLE=\"table-layout:fixed;\">" + "<TR><TD CLASS=\"" + cc + "\" STYLE=\"font-size:" + (e.d ? sz.Tds : sz.Tfs) + "px;color:" + _4 + "\"" + " TITLE=\"" + (e.d ? "Duplicate: " : "") + EH(fn) + "\">" + (e.d ? "<I>Duplicate:</I><BR>" : "") + (e.m ? "<B>" : "") + EL(tn) + (e.m ? "</B>" : "") + "</TD></TR>" + rs + "</TABLE>";
    o.appendChild(v);

我输入了这段代码,但它无效:

jQuery(window).load( function(){ 
  jQuery('.di').on( 'click', function ( _ev ) { 
    jQuery('.sidebar-wrapper').fadeIn(500); 
  }); 

  jQuery('.sidebar-wrapper .sidebar-close').on( 'click', function ( _ev ) {
    jQuery('.sidebar-wrapper').fadeOut(500); 
  }); 
});

1 个答案:

答案 0 :(得分:0)

jQuery(document).ready( function(){ 
  jQuery('body').on( 'click','.dcelld', function ( _ev ) { 
    jQuery('.sidebar-wrapper').fadeIn(500); 
  }); 

  jQuery('body').on( 'click','.sidebar-wrapper .sidebar-close', function ( _ev ) {
    jQuery('.sidebar-wrapper').fadeOut(500); 
  }); 
});