score:0
check out onmousedown and onmouseup to have a little more control.
A click
is a full completion of both of these events (mouse down, then mouse up). I think you're looking for the mouse down even.
score:1
From this example, you can add if (d3.event.defaultPrevented) return;
into your click event to prevent it from happening when a zoom is happening.
.on("click",function(){
if (d3.event.defaultPrevented) return;
alert("CLICKED!!")
})
Here is an implementation, from your fiddle.
Source: stackoverflow.com
Related Query
- How to prevent the on ("click") event from activating when I'm doing drag?
- How to prevent bubbles from touching the svg frame/border when using D3.js force?
- How to prevent d3 from triggering drag on right click?
- How to stop Angular handling a click event from within d3
- How to add a force drag event in D3 and make the node stay where i leave it?
- D3 - Prevent parent <g> element from firing click event
- How can I display tooltips from multiple maps when mousover on one of the maps in D3js
- In a d3 scatterplot using data from a csv file, how do i draw lines connecting related points when the mouse is over a point?
- How to prevent the drag if the user clicks the round in d3.js?
- How to prevent click event for mouseup event
- 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 properly control the context when using d3.json event handler
- Using d3 - How do I select specific data from array to highlight when I click a button?
- How to disable click event after drag stop in d3.js tree
- how can i prevent d3.behavior.zoom().on("zoom", redraw) from being used when i mousedrag on my nodes?
- How do I pass event variable/place a marker on the map - when binding done events in Datamaps & D3?
- D3.js how prevent drag-start on click event
- d3js - how to prevent the `line` from `null` values in json data?
- Prevent d3 brush from firing a click event
- How can I listen mouse events from d3 when jquery drag & drop is in action?
- How to prevent the last tick from rendering? Using 'recharts' library
- D3 - How can I show/hide a text element when hovering a circle element created from different attributes of the same data entry?
- D3,js on mouse event CLICK appending only the first image from data set
- how to adjust width and height when i click the rect in multilevel treeemap using d3.js?
- How to manually trigger the drag event of d3
- D3.js: How to create the pop-up event when moving mouse on the svg?
- How do I prevent graph elements from reaching the axis of my graph in D3 and scale properly?
- D3: How to stop child nodes from being attracted towards the center when parent is dragged in force-directed tree?
- How to forcefully call the drag event right after the creation of an dom element in d3?
- how can i display the value from tsv file when i have # in d3
More Query from same tag
- Zoom with Axis: undefined is not an object (evaluating 'd3.event.transform')
- bar chart in d3 using mysql database
- Nivo Pie Chart Not Rendering
- d3-generated SVG is not responsive
- Dynamic filtering with D3
- Add a Circle for Every nth Data Element d3.js
- Adding tooltips on a bar in Gantt Chart in D3js
- Zooming in D3 v4 on a globe
- Is d3.mouse( mySVG[0][0]) really the right way to address the container?
- Multiple animation along path with D3
- D3.js Can't update existing element in group
- Mobile Responsive Javascript Map
- Why can't I get the Bounding Box of this d3.js text?
- d3 dynamic data in bar graph
- interpolate both startAngle and endAngle using d3
- D3.js spawn new circles at fixed time intervals with forceSimulation
- d3.js line chart with negative numbers
- Radar chart library similar to nv-d3.js
- Difference in chaining D3.js transitions
- Event Handling in nvd3
- In D3, How to disable double click zoom conditionally?
- how to use d3.js in sonarqube widgets
- programmatically trigger click event in svg rect element
- Append text or circle in heatmap grid of d3js
- Creating a zoom function in D3
- How to access the data in an array
- Why these simple circles in D3 are not showing?
- How to repeat rotation using d3
- How to implement the html variables for a graphic from d3.js
- Loading my simple D3 project in chrome gives me this error. "Failed to load resource: net::ERR_NAME_NOT_RESOLVED". What can I do to fix it?