I've written a D3 method that changes the text in a tag (a tooltip of sorts). This happens when I click a node in a force-directed graph. However, when I doubleclick I would like to hide certain nodes. Without the tooltip this works just fine, but when I include the code to change the tooltip, the doubleclick doesn't seem to work. Any help would be greatly appreciated.
function tooltip(d) {
console.log("Clickvar: " + clickvar);
if (clickvar == false) {
div.transition()
.duration(300)
.style("opacity", .9);
div.html("<p>Top-tag: \n" + d.tag + "</p><p>Contacts: "+ d.contacts + "</p>")
.style("left", d3.event.pageX + "px")
.style("top", d3.event.pageY + "px");
clickvar = true;
}
else {
div.transition()
.duration(100)
.style("opacity", 0);
clickvar = false;
}
}