Hello,
Does anyone have an example of creating a jquery context menu on right clicking of a node?
Thanks!
Hello,
Does anyone have an example of creating a jquery context menu on right clicking of a node?
Thanks!
This does not use jQuery, but have you seen HTML Context Menu, which demonstrates two different kinds of HTML context menus?
Yes, I have seen the example. In the example, it reads “// This would be easier with a library like jQuery,”. I was using jquery for another context menu on my page so I thought to keep my code clean it would be nice to us the same kind of context window.
So far I have:
var graphObjectMake = go.GraphObject.make;
Diagram.addDiagramListener(“ObjectContextClicked”,
function(e,t) {
var mousePt = Diagram.lastInput.viewPoint;
var part = e.subject.part;
if (!(part instanceof go.Link))
{
$(’#ContextMenuDiv’).menu(‘show’,{
left: mousePt.x,
top: mousePt.y
});
}
}
);
The following is the code to open a jquery window by right clicking anywhere on the document:
$(function(){
$(document).bind(‘contextmenu’,function(e){
e.preventDefault();
$(’#ContextMenuDiv’).menu(‘show’, {
left: e.pageX,
top: e.pageY
});
});
});