如何在JGraph的弹出菜单中设置样式?

时间:2019-03-09 13:15:16

标签: javascript css jgraph

我使用js库JGraph。我如下更改样式:

var mxPopupMenuShowMenu = mxPopupMenu.prototype.showMenu;
mxPopupMenu.prototype.showMenu = function()
{
    mxPopupMenuShowMenu.apply(this, arguments);
    var _div = this.div;
    _div.style.backgroundColor = 'darkgrey'; // background color
    _div.style.border = 'none'; // border
    _div.onmouseover = function(){ // over in
            console.log('mouse over in popur');
    }
    _div.onmouseout = function(){ // over out
            console.log('mouse over out popur');
    }
};

这可以工作,但是我想在子菜单上悬停时编辑背景颜色,并且我想在整个菜单中编辑字体颜色。如何制作?谢谢。

1 个答案:

答案 0 :(得分:0)

我找到了使用CSS的jgraph弹出菜单的方法集样式:

body div.mxPopupMenu {
    -webkit-box-shadow: 3px 3px 6px #C0C0C0;
    -moz-box-shadow: 3px 3px 6px #C0C0C0;
    box-shadow: 3px 3px 6px #C0C0C0;
    background: darkgrey;
    color: white;
    border: none;
    position: absolute;
    padding: 3px;
}
body table.mxPopupMenu {
    border-collapse: collapse;
    margin: 0px;
}
body tr.mxPopupMenuItem {
    color: white;
    cursor: hand;
}
body td.mxPopupMenuItem {
    padding: 6px 60px 6px 30px;
    font-family: Arial;
    font-size: 10pt;
}
body td.mxPopupMenuIcon {
    background-color: white;
    padding: 0px;
}
body tr.mxPopupMenuItemHover {
    background-color: black;
    color: white;
}
table.mxPopupMenu hr {
    border-top: solid 1px #cccccc;
}
table.mxPopupMenu tr {
    font-size: 4pt;
}