Last active
May 27, 2019 14:12
-
-
Save intv0id/e50d447d3e980e01e58467ca3bbcf265 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var onEnter, onExit, $d, hovered; | |
$d = $('.label'); | |
$d.hide(); | |
//hovered = jgraph.makeMaterial(0xffffff); | |
onEnter = function (node) { | |
$d.html('<p><b>' + node.name + '</b></p><br><p>' + node.label + '</p>'); | |
$d.show(); | |
node.defaultMaterial = node.material; | |
node.material = hovered; | |
}; | |
onExit = function (node) { | |
$d.empty(); | |
$d.hide(); | |
node.material = node.defaultMaterial; | |
}; | |
jgraph.onNodeHover(onEnter, onExit); | |
// Move the text showing name along with the mouse | |
$(document).mousemove(function (event) { | |
$d.css({ left: event.pageX + 10, top: event.pageY + 10 }); | |
}); | |
// Pop up a github window if a node is clicked | |
jgraph.onNodeClick(function (node) { | |
window.open(node.url, "_blank"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment