Reputation: 21
Since the nodes in a cytoscape.js graph are on a canvas I'm not sure how to go about marrying the two together.
I guess a generic version of the question is, how can jQuery find a node?
I've tried the cytoscape.js-cxtmenu
circular context menu. And while it's very cool, we'd like a more traditional popup menu. In another SO question (which is closed) context.js was recommended.
Reusing the demo.js
from that page it seems line I need to modify this line
context.attach($("#layer2-node").get(0))
and replace it with something like
context.attach(document.getElementById('cy').elements())
however, that doesn't seem to work.
thoughts?
Upvotes: 1
Views: 819
Reputation: 12242
Generally, you have to create dummy DOM elements per node as needed to call a DOM library. This is the approach the qtip extension uses, creating divs on demand.
If you can specify positions/offsets in the lib, then you could alternatively just use your container DOM element.
Upvotes: 1