score:5
Accepted answer
here is a solution:
var tooltip = d3.select("#tooltip");
var tooltipwithcontent = d3.selectall("#tooltip, #tooltip *");
function equaltoeventtarget() {
return this == d3.event.target;
}
d3.select("body").on("click",function(){
var outside = tooltipwithcontent.filter(equaltoeventtarget).empty();
if (outside) {
tooltip.classed("hidden", true);
}
});
Source: stackoverflow.com
Related Query
- d3.js when click outside the elements, hide the element
- D3.js: Text labels dissapear when I click on the second svg element
- d3.select("#element") not working when code above the html element
- d3.js - How can I set the cursor to hand when mouseover these elements on SVG container?
- How to update elements of D3 force layout when the underlying data changes
- mouseout/mouseleave gets fired when mouse moves INSIDE the svg path element
- Why does this D3 code add the <p> element outside the body, instead of inside it?
- How to avoid the overlapping of text elements on the TreeMap when child elements are opened in D3.js?
- Why do the mouseenter/mouseleave events fire when entering/leaving child elements in an SVG?
- When running a D3 update/enter/exit, how to ignore already exiting elements during the new exit?
- How do I hide the text labels in d3 when the nodes are too small?
- Cannot click div when it overlays clickable d3 elements
- D3.js - Highlight chart elements when interacting with the legend & vice versa
- Rotate element thrown outside the SVG
- D3 hide overflow of the chart area, when Y axis has a min and max
- D3.js Right click opens popup but does not affect the source svg when pop up closed
- Why d3.domain() has only one element when I use the whole data array as domain?
- How to show the value of each element when hovering
- When i click on the marker, the pop up doesn't appear. I get the following error
- Why are my donut charts positioned outside the container when other chart types are correctly positioned?
- Using d3.behavior.drag, How to keep a drag image visible outside of the svg element
- Implementing shift click and click functionality on the same element
- div element is getting appended outside the body
- Can I use selectAll to create new element when elements of same type already exist?
- Darken the color of svg element each time on button click using D3 V3 or JavaScript
- How to remove event listener of an element when I remove the corresponding element in the midst of the event being triggered in D3?
- How to change properties of elements in a SVG when I mouseover an element of a second SVG using D3
- Hide the first element of the organizational structure d3.js
- Center SVG <tspan> elements when surrounding <text> element has text-anchor=start
- D3.js how to write pop-out box that appears when the user clicks on an element
More Query from same tag
- d3.js: Path intersects axis in between ticks
- c3js How does one format a timestamp from seconds since the epoch to a normal date?
- nice() method for ticks in nvd3
- brush extents not working as expected
- d3 filling an area with a gradient
- D3 Panning Chart with Dates
- Stackbar chart in dcjs split by dimension
- How to display data with a specific property value in d3.js only on click/hover
- nvd3 multibarchart height and label issue
- Opening downloaded Gist folder to inspect elements
- How to plot line chart using Json File
- Can dc.js render a bar chart without dimension?
- D3JS Barchart : How to allow repeated x-axis label values?
- Strange spacing of dates on x-axis (D3)
- Leaflet: How to get pixel position of a lat lng after zoom, before zoom begins
- How do I get a topojson layer to show up in leaflet using d3?
- make axis of radar chart conditional to existence of value
- d3.js linkStrength influence on linkDistance in a force graph
- How to check if the mouse is inside actual map bounds in d3 geo?
- Repositioning SVG:rect elements created using d3.js (Using either d3 or jQuery)
- Multiple d3 charts on a page using the same Angular2 component
- Django d3.js load JSON data
- Get the value of Y axis minimum and maximum limits in Billboard.js
- d3.js line not drawing because of x function
- plotting multi dimensions in DC for D3
- SVG does not show up on Firefox but does on Chrome
- How to speed up the force layout animation in d3.js
- scale incoming metric data for representation in cubism
- Sorting large CSV in D3.js
- d3 line chart not getting terminated